Add client tag accessor to NdbNote
Add a clientTag property to NdbNote that parses and returns the client tag metadata from an event's tags, enabling display of which app published an event. Ref: https://github.com/damus-io/damus/issues/3323 Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
7f2c575f20
commit
f3361e6eae
@@ -470,6 +470,19 @@ extension NdbNote {
|
||||
public var references: References<RefId> {
|
||||
References<RefId>(tags: self.tags)
|
||||
}
|
||||
|
||||
/// Parses and returns the client tag metadata if present on this note.
|
||||
var clientTag: ClientTagMetadata? {
|
||||
for tag in tags {
|
||||
guard tag.count >= 2, tag[0].matches_str("client") else {
|
||||
continue
|
||||
}
|
||||
if let metadata = ClientTagMetadata(tagComponents: tag.strings()) {
|
||||
return metadata
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func thread_reply() -> ThreadReply? {
|
||||
if self.known_kind != .highlight {
|
||||
|
||||
Reference in New Issue
Block a user