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>
This commit is contained in:
William Casarin
2022-08-19 07:38:13 -07:00
parent 3b7f7706b5
commit cb70ab532c
5 changed files with 6 additions and 5 deletions

View File

@@ -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))

View File

@@ -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

View File

@@ -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 {

View File

@@ -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")
}

View File

@@ -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")
}