damus

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

commit 7467a9d5b1380d8b200cdf4b11ae36520630b604
parent 9f01cab2be68d665005d7bb626a2f9d875e938ad
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  9 Aug 2023 09:16:29 -0700

Fix empty lines in profile and reposting-the-wrong-thing bugs

Changelog-Fixed: Fixed issue where reposts would sometimes repost the wrong thing
Changelog-Fixed: Fixed issues where sometimes there would be empty entries on your profile

Diffstat:
Mdamus/Nostr/NostrEvent.swift | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift @@ -477,18 +477,12 @@ func make_metadata_event(keypair: FullKeypair, metadata: Profile) -> NostrEvent? } func make_boost_event(keypair: FullKeypair, boosted: NostrEvent) -> NostrEvent? { - var tags = boosted.tags.reduce(into: [[String]]()) { ts, tag in - guard tag.count >= 2 && (tag[0].matches_char("e") || tag[0].matches_char("p")) else { - return - } - - ts.append(tag.strings()) - } + var tags = Array(boosted.referenced_pubkeys).map({ pk in pk.tag }) tags.append(["e", boosted.id.hex(), "", "root"]) tags.append(["p", boosted.pubkey.hex()]) - let content = boosted.content_len <= 100 ? event_to_json(ev: boosted) : "" + let content = event_to_json(ev: boosted) return NostrEvent(content: content, keypair: keypair.to_keypair(), kind: 6, tags: tags) }