Fixing @user in comments doesn't work if it's in a separate line

This commit is contained in:
Sam X. Chen 2019-09-11 09:05:16 -04:00
parent 753d5b953d
commit e0046032e8
2 changed files with 13 additions and 7 deletions

View file

@ -381,6 +381,10 @@ a
display: block
word-wrap: break-word
table
word-wrap: normal
word-break: normal
ol
list-style-type: decimal
padding-left: 20px

View file

@ -180,7 +180,7 @@ if (Meteor.isServer) {
const comment = activity.comment();
params.comment = comment.text;
if (board) {
const atUser = /(?:^|>|\b|\s)@(\S+)(?:\s|$|<|\b)/g;
const atUser = /(?:^|>|\b|\s)@(\S+?)(?:\s|$|<|\b)/g;
const comment = params.comment;
if (comment.match(atUser)) {
const commenter = params.user;
@ -192,12 +192,14 @@ if (Meteor.isServer) {
}
const atUser =
Users.findOne(username) || Users.findOne({ username });
const uid = atUser && atUser._id;
params.atUsername = username;
params.atEmails = atUser.emails;
if (board.hasMember(uid)) {
title = 'act-atUserComment';
watchers = _.union(watchers, [uid]);
if (atUser && atUser._id) {
const uid = atUser._id;
params.atUsername = username;
params.atEmails = atUser.emails;
if (board.hasMember(uid)) {
title = 'act-atUserComment';
watchers = _.union(watchers, [uid]);
}
}
}
}