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

This commit is contained in:
Elias Nahum 2021-04-09 23:10:12 -04:00 committed by GitHub
parent c22e93ddb0
commit 06f8f0b3a5
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;
}