mirror of
git://jb55.com/damus
synced 2024-09-18 19:23:49 +00:00
notes: generalize event_is_reply a bit
so that it works with NdbNote as well
This commit is contained in:
parent
6fa9149939
commit
b5dd90b36a
@ -146,8 +146,8 @@ func interpret_event_refs(blocks: [Block], tags: [[String]]) -> [EventRef] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func event_is_reply(_ ev: NostrEvent, privkey: String?) -> Bool {
|
func event_is_reply(_ refs: [EventRef]) -> Bool {
|
||||||
return ev.event_refs(privkey).contains { evref in
|
return refs.contains { evref in
|
||||||
return evref.is_reply != nil
|
return evref.is_reply != nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ extension NostrEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func is_reply(_ privkey: String?) -> Bool {
|
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? {
|
func note_language(_ privkey: String?) -> String? {
|
||||||
|
@ -14,7 +14,7 @@ struct ReplyPart: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
if event_is_reply(event, privkey: privkey) {
|
if event_is_reply(event.event_refs(privkey)) {
|
||||||
ReplyDescription(event: event, profiles: profiles)
|
ReplyDescription(event: event, profiles: profiles)
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
|
@ -42,7 +42,7 @@ struct SelectedEventView: View {
|
|||||||
.minimumScaleFactor(0.75)
|
.minimumScaleFactor(0.75)
|
||||||
.lineLimit(1)
|
.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)
|
ReplyDescription(event: event, profiles: damus.profiles)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ extension NdbNote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func is_reply(_ privkey: String?) -> Bool {
|
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? {
|
func note_language(_ privkey: String?) -> String? {
|
||||||
|
Loading…
Reference in New Issue
Block a user