damus

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

commit d455d86a05e3e97a6d83778d7a1334666d975511
parent c67741983e3f07f2386eaa388cb8a1475e8e0471
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 22 Jan 2024 15:00:20 -0800

mention: fix missing @ on mentions

Fixes: d07ad6777882 ("nip19: add bech32 TLV url parsing")

Diffstat:
Mdamus/Models/NoteContent.swift | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/damus/Models/NoteContent.swift b/damus/Models/NoteContent.swift @@ -191,18 +191,20 @@ func getDisplayName(pk: Pubkey, profiles: Profiles) -> String { func mention_str(_ m: Mention<MentionRef>, profiles: Profiles) -> CompatibleText { let bech32String = Bech32Object.encode(m.ref.toBech32Object()) - let attributedStringLiteral: String = { + let display_str: String = { switch m.ref { case .pubkey(let pk): return getDisplayName(pk: pk, profiles: profiles) - case .note: return "@\(abbrev_pubkey(bech32String))" - case .nevent: return "@\(abbrev_pubkey(bech32String))" + case .note: return abbrev_pubkey(bech32String) + case .nevent: return abbrev_pubkey(bech32String) case .nprofile(let nprofile): return getDisplayName(pk: nprofile.author, profiles: profiles) case .nrelay(let url): return url - case .naddr: return "@\(abbrev_pubkey(bech32String))" + case .naddr: return abbrev_pubkey(bech32String) } }() - - var attributedString = AttributedString(stringLiteral: attributedStringLiteral) + + let display_str_with_at = "@\(display_str)" + + var attributedString = AttributedString(stringLiteral: display_str_with_at) attributedString.link = URL(string: "damus:nostr:\(bech32String)") attributedString.foregroundColor = DamusColors.purple