mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 01:29:21 +00:00
Fix regex for chat highlighting (#9411)
* Fix regex for chat highlighting * Fix lint errors
This commit is contained in:
parent
229fd06ee3
commit
22b683b1d9
1 changed files with 3 additions and 1 deletions
|
|
@ -246,6 +246,7 @@ import moment from 'moment';
|
|||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import { mapState } from 'client/libs/store';
|
||||
import debounce from 'lodash/debounce';
|
||||
import escapeRegExp from 'lodash/escapeRegExp';
|
||||
import markdownDirective from 'client/directives/markdown';
|
||||
import Avatar from '../avatar';
|
||||
import styleHelper from 'client/mixins/styleHelper';
|
||||
|
|
@ -352,7 +353,8 @@ export default {
|
|||
let messagetext = message.text.toLowerCase();
|
||||
let username = user.profile.name;
|
||||
let mentioned = messagetext.indexOf(username.toLowerCase());
|
||||
let pattern = `${username}([^\w]|$){1}`;
|
||||
let escapedUsername = escapeRegExp(username);
|
||||
let pattern = `${escapedUsername}([^\w]|$){1}`;
|
||||
|
||||
if (mentioned === -1) return message.highlight;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue