fix(Chat): Allow for case insensitive pubkey replacement
When entering a user name like `@Pascal` it wouldn't be properly replaced with the pubKey of `pascal.stateofus.eth` since it was comparing to `@pascal` This commit ensures simple user name mentions are properly matched against their ens names regardles of their case. Fixes part of #769
This commit is contained in:
parent
de5b62030b
commit
bdfdf263cc
|
@ -104,7 +104,7 @@ QtObject:
|
|||
proc replaceMentionsWithPubKeys(self: ChatsView, mentions: seq[string], contacts: seq[Profile], message: string, predicate: proc (contact: Profile): string): string =
|
||||
result = message
|
||||
for mention in mentions:
|
||||
let matches = contacts.filter(c => "@" & predicate(c) == mention).map(c => c.address)
|
||||
let matches = contacts.filter(c => "@" & predicate(c).toLowerAscii == mention.toLowerAscii).map(c => c.address)
|
||||
if matches.len > 0:
|
||||
let pubKey = matches[0]
|
||||
result = message.replace(mention, "@" & pubKey)
|
||||
|
|
Loading…
Reference in New Issue