damus

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

commit 1e7d9a6373d359b498faafc5f7680babed2e5030
parent 3c2f281c6d2a4633d85be8ef40c6b10c14626884
Author: gladiusKatana <garthsnyder@protonmail.com>
Date:   Mon, 13 Mar 2023 02:36:43 -0400

Fix mentions not working in middle of new note

Changelog-Fixed: Fix mentions not working in middle of new note
Closes: #775

Diffstat:
Mdamus/Views/PostView.swift | 12++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift @@ -170,24 +170,20 @@ struct PostView: View { } func get_searching_string(_ post: String) -> String? { - guard let last_word = post.components(separatedBy: .whitespacesAndNewlines).last else { + guard let handle = post.components(separatedBy: .whitespacesAndNewlines).first(where: {$0.first == "@"}) else { return nil } - guard last_word.count >= 2 else { - return nil - } - - guard last_word.first! == "@" else { + guard handle.count >= 2 else { return nil } // don't include @npub... strings - guard last_word.count != 64 else { + guard handle.count != 64 else { return nil } - return String(last_word.dropFirst()) + return String(handle.dropFirst()) } struct PostView_Previews: PreviewProvider {