damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit cb70ab532c2df0ab40c6b80f074747cdf7dbb05d
parent 3b7f7706b5494ccd4230e3d96b5f02ff337c0d6c
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 19 Aug 2022 07:38:13 -0700

Use the `t` tag for hashtags

Changelog-Changed: #hashtags now use the `t` tag instead of `hashtag`
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Models/Mentions.swift | 2+-
Mdamus/Nostr/NostrFilter.swift | 2+-
Mdamus/Views/NoteContentView.swift | 2+-
Mdamus/Views/ThreadView.swift | 1+
MdamusTests/damusTests.swift | 4++--
5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/damus/Models/Mentions.swift b/damus/Models/Mentions.swift @@ -264,7 +264,7 @@ func make_post_tags(post_blocks: [PostBlock], tags: [[String]]) -> PostTags { blocks.append(block) } case .hashtag(let hashtag): - new_tags.append(["hashtag", hashtag.lowercased()]) + new_tags.append(["t", hashtag.lowercased()]) blocks.append(.hashtag(hashtag)) case .text(let txt): blocks.append(Block.text(txt)) diff --git a/damus/Nostr/NostrFilter.swift b/damus/Nostr/NostrFilter.swift @@ -23,7 +23,7 @@ struct NostrFilter: Codable { case kinds case referenced_ids = "#e" case pubkeys = "#p" - case hashtag = "#hashtag" + case hashtag = "#t" case since case until case authors diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift @@ -63,7 +63,7 @@ struct NoteContentView: View { } func hashtag_str(_ htag: String) -> String { - return "[#\(htag)](nostr:hashtag:\(htag))" + return "[#\(htag)](nostr:t:\(htag))" } func mention_str(_ m: Mention, profiles: Profiles) -> String { diff --git a/damus/Views/ThreadView.swift b/damus/Views/ThreadView.swift @@ -80,6 +80,7 @@ func should_show_chatroom(_ ev: NostrEvent) -> Bool { } func tag_is_hashtag(_ tag: [String]) -> Bool { + // "hashtag" is deprecated, will remove in the future return tag.count >= 2 && (tag[0] == "hashtag" || tag[0] == "t") } diff --git a/damusTests/damusTests.swift b/damusTests/damusTests.swift @@ -79,9 +79,9 @@ class damusTests: XCTestCase { XCTAssertEqual(ev.tags.count, 2) XCTAssertEqual(ev.content, "#damus some content #bitcoin derp") - XCTAssertEqual(ev.tags[0][0], "hashtag") + XCTAssertEqual(ev.tags[0][0], "t") XCTAssertEqual(ev.tags[0][1], "damus") - XCTAssertEqual(ev.tags[1][0], "hashtag") + XCTAssertEqual(ev.tags[1][0], "t") XCTAssertEqual(ev.tags[1][1], "bitcoin") }