remove @ if not needed (#2126)

This commit is contained in:
Mauro 2023-11-21 11:02:23 +01:00 committed by GitHub
parent bec6cdac05
commit 053e134a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,9 @@ struct PlainMentionBuilder: MentionBuilderProtocol {
func handleAllUsersMention(for attributedString: NSMutableAttributedString, in range: NSRange) { }
func handleUserMention(for attributedString: NSMutableAttributedString, in range: NSRange, url: URL, userID: String) {
guard !attributedString.attributedSubstring(from: range).string.hasPrefix("@") else {
return
}
attributedString.insert(NSAttributedString(string: "@"), at: range.location)
}
}