commit b5dd90b36a5e5d29bd3b665fb2a97190dde5eb71
parent 6fa9149939b68915aeacc60ab37b1fa87abbc054
Author: William Casarin <jb55@jb55.com>
Date: Mon, 24 Jul 2023 12:39:41 -0700
notes: generalize event_is_reply a bit
so that it works with NdbNote as well
Diffstat:
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/damus/Models/EventRef.swift b/damus/Models/EventRef.swift
@@ -146,8 +146,8 @@ func interpret_event_refs(blocks: [Block], tags: [[String]]) -> [EventRef] {
}
-func event_is_reply(_ ev: NostrEvent, privkey: String?) -> Bool {
- return ev.event_refs(privkey).contains { evref in
+func event_is_reply(_ refs: [EventRef]) -> Bool {
+ return refs.contains { evref in
return evref.is_reply != nil
}
}
diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift
@@ -250,7 +250,7 @@ extension NostrEvent {
}
func is_reply(_ privkey: String?) -> Bool {
- return event_is_reply(self, privkey: privkey)
+ return event_is_reply(self.event_refs(privkey))
}
func note_language(_ privkey: String?) -> String? {
diff --git a/damus/Views/Events/Components/ReplyPart.swift b/damus/Views/Events/Components/ReplyPart.swift
@@ -14,7 +14,7 @@ struct ReplyPart: View {
var body: some View {
Group {
- if event_is_reply(event, privkey: privkey) {
+ if event_is_reply(event.event_refs(privkey)) {
ReplyDescription(event: event, profiles: profiles)
} else {
EmptyView()
diff --git a/damus/Views/Events/SelectedEventView.swift b/damus/Views/Events/SelectedEventView.swift
@@ -42,7 +42,7 @@ struct SelectedEventView: View {
.minimumScaleFactor(0.75)
.lineLimit(1)
- if event_is_reply(event, privkey: damus.keypair.privkey) {
+ if event_is_reply(event.event_refs(damus.keypair.privkey)) {
ReplyDescription(event: event, profiles: damus.profiles)
.padding(.horizontal)
}
diff --git a/nostrdb/NdbNote.swift b/nostrdb/NdbNote.swift
@@ -296,7 +296,7 @@ extension NdbNote {
}
func is_reply(_ privkey: String?) -> Bool {
- return event_is_reply(self, privkey: privkey)
+ return event_is_reply(self.event_refs(privkey))
}
func note_language(_ privkey: String?) -> String? {