MM-34714 fix mention highlight to dismiss mentions for non existent users (#5300) (#5305)

(cherry picked from commit 06f8f0b3a5)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2021-04-10 17:56:57 +02:00 committed by GitHub
parent f0fb2abba4
commit bd767ad7fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View file

@ -9,14 +9,7 @@ exports[`AtMention should match snapshot, no highlight 1`] = `
}
>
<Text
style={
Array [
Object {
"backgroundColor": "#ffe577",
"color": "#145dbf",
},
]
}
style={Array []}
>
@John.Smith
</Text>

View file

@ -174,12 +174,12 @@ export default class AtMention extends React.PureComponent {
} else {
const pattern = new RegExp(/\b(all|channel|here)(?:\.\B|_\b|\b)/, 'i');
const mentionMatch = pattern.exec(mentionName);
highlighted = true;
if (mentionMatch) {
mention = mentionMatch.length > 1 ? mentionMatch[1] : mentionMatch[0];
suffix = mentionName.replace(mention, '');
isMention = true;
highlighted = true;
} else {
mention = mentionName;
}