Mentions are disabled by non-word instead of space

This commit is contained in:
Cadence Ember 2020-05-20 03:36:51 +12:00
parent 13339efa9e
commit 3282d81ec4
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ function partsUsername(parts) {
for (let i = 0; i < parts.length; i++) {
if (parts[i].type === "text") {
tryMatch(parts[i].text, new RegExp(`@(${constants.external.username_regex})`, "g"), match => {
if (match.index === 0 || parts[i].text[match.index-1].match(/\s/)) { // check that there's a space before the username
if (match.index === 0 || parts[i].text[match.index-1].match(/\W/)) { // check that there isn't a word directly before the username
replacePart(parts, i, match, [
{type: "user", text: match[0], user: match[1]}
])