From 7467a9d5b1380d8b200cdf4b11ae36520630b604 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 9 Aug 2023 09:16:29 -0700 Subject: [PATCH] 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 --- damus/Nostr/NostrEvent.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift index 18a6be60..17373452 100644 --- 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) }