fix a minor mention issue that it won't show the name if there is no white space after a mention
This commit is contained in:
parent
12a995bc91
commit
7c82ede432
|
@ -14,7 +14,7 @@ public final class MentionUtilities : NSObject {
|
|||
MentionsManager.populateUserPublicKeyCacheIfNeeded(for: threadID, in: transaction)
|
||||
}
|
||||
var string = string
|
||||
let regex = try! NSRegularExpression(pattern: "@[0-9a-fA-F]*", options: [])
|
||||
let regex = try! NSRegularExpression(pattern: "@[0-9a-fA-F]{66}", options: [])
|
||||
let knownPublicKeys = MentionsManager.userPublicKeyCache[threadID] ?? [] // Should always be populated at this point
|
||||
var mentions: [(range: NSRange, publicKey: String)] = []
|
||||
var outerMatch = regex.firstMatch(in: string, options: .withoutAnchoringBounds, range: NSRange(location: 0, length: string.utf16.count))
|
||||
|
|
|
@ -201,7 +201,7 @@ private extension String {
|
|||
func replacingMentions(for threadID: String, using transaction: YapDatabaseReadWriteTransaction) -> String {
|
||||
MentionsManager.populateUserPublicKeyCacheIfNeeded(for: threadID, in: transaction)
|
||||
var result = self
|
||||
let regex = try! NSRegularExpression(pattern: "@[0-9a-fA-F]*", options: [])
|
||||
let regex = try! NSRegularExpression(pattern: "@[0-9a-fA-F]{66}", options: [])
|
||||
let knownPublicKeys = MentionsManager.userPublicKeyCache[threadID] ?? []
|
||||
var mentions: [(range: NSRange, publicKey: String)] = []
|
||||
var m0 = regex.firstMatch(in: result, options: .withoutAnchoringBounds, range: NSRange(location: 0, length: result.utf16.count))
|
||||
|
|
Loading…
Reference in New Issue