damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 6fa9149939b68915aeacc60ab37b1fa87abbc054
parent 1e9e4a7f3a532408be98cd3c076d295bd7ee74f0
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 24 Jul 2023 11:05:18 -0700

ndb: avoid double constructor on References

Diffstat:
Mdamus/ContentParsing.swift | 2+-
Mdamus/Nostr/ReferencedId.swift | 4++--
Mnostrdb/NdbNote.swift | 4++--
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/damus/ContentParsing.swift b/damus/ContentParsing.swift @@ -83,7 +83,7 @@ func interpret_event_refs_ndb(blocks: [Block], tags: TagsSequence) -> [EventRef] /// simpler case with no mentions if mention_indices.count == 0 { - let ev_refs = References(tags: tags).ids() + let ev_refs = References.ids(tags: tags) return interp_event_refs_without_mentions_ndb(ev_refs) } diff --git a/damus/Nostr/ReferencedId.swift b/damus/Nostr/ReferencedId.swift @@ -39,12 +39,12 @@ struct References: Sequence, IteratorProtocol { } - func ids() -> LazyFilterSequence<References> { + static func ids(tags: TagsSequence) -> LazyFilterSequence<References> { References(tags: tags).lazy .filter() { ref in ref.key == "e" } } - func pubkeys() -> LazyFilterSequence<References> { + static func pubkeys(tags: TagsSequence) -> LazyFilterSequence<References> { References(tags: tags).lazy .filter() { ref in ref.key == "p" } } diff --git a/nostrdb/NdbNote.swift b/nostrdb/NdbNote.swift @@ -168,11 +168,11 @@ extension NdbNote { // TODO: References iterator public var referenced_ids: LazyFilterSequence<References> { - References(tags: self.tags()).ids() + References.ids(tags: self.tags()) } public var referenced_pubkeys: LazyFilterSequence<References> { - References(tags: self.tags()).pubkeys() + References.pubkeys(tags: self.tags()) } func event_refs(_ privkey: String?) -> [EventRef] {