From e0046032e865dca408ceb78d0afbdec723cb3e28 Mon Sep 17 00:00:00 2001 From: "Sam X. Chen" Date: Wed, 11 Sep 2019 09:05:16 -0400 Subject: [PATCH] Fixing @user in comments doesn't work if it's in a separate line --- client/components/main/layouts.styl | 4 ++++ models/activities.js | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/client/components/main/layouts.styl b/client/components/main/layouts.styl index 56c352849..01ce2f160 100644 --- a/client/components/main/layouts.styl +++ b/client/components/main/layouts.styl @@ -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 diff --git a/models/activities.js b/models/activities.js index a864e5e4d..dcabfbc23 100644 --- a/models/activities.js +++ b/models/activities.js @@ -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]); + } } } }