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:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user