Add support for rendering highlights with comments

This commit implements rendering comments from the `["comment",
<COMMENT_TEXT>]` tag in a highlight note.

Comment contents get rendered like a kind 1 note's "content" field

This commit also adds the `r` "reference" tag as a standard tag reference type

Changelog-Added: Add support for rendering highlights with comments
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2024-08-17 14:55:23 -07:00
committed by William Casarin
parent 5834e1ee9b
commit d71d448ac8
8 changed files with 69 additions and 12 deletions

View File

@@ -335,6 +335,10 @@ extension NdbNote {
public var referenced_mute_items: References<MuteItem> {
References<MuteItem>(tags: self.tags)
}
public var referenced_comment_items: References<CommentItem> {
References<CommentItem>(tags: self.tags)
}
public var references: References<RefId> {
References<RefId>(tags: self.tags)
@@ -355,6 +359,9 @@ extension NdbNote {
if known_kind == .dm {
return decrypted(keypair: keypair) ?? "*failed to decrypt content*"
}
else if known_kind == .highlight {
return self.referenced_comment_items.first?.content ?? ""
}
return content
}