summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorSam X. Chen <sam.xi.chen@gmail.com>2019-09-11 09:05:16 -0400
committerSam X. Chen <sam.xi.chen@gmail.com>2019-09-11 09:05:16 -0400
commite0046032e865dca408ceb78d0afbdec723cb3e28 (patch)
tree95059bddb9aa519b8058c2283c18f75c2a162f29 /models
parent753d5b953dc52be198d0e6dd967161b81c21d27b (diff)
downloadwekan-e0046032e865dca408ceb78d0afbdec723cb3e28.tar.gz
wekan-e0046032e865dca408ceb78d0afbdec723cb3e28.tar.bz2
wekan-e0046032e865dca408ceb78d0afbdec723cb3e28.zip
Fixing @user in comments doesn't work if it's in a separate line
Diffstat (limited to 'models')
-rw-r--r--models/activities.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/models/activities.js b/models/activities.js
index a864e5e4..dcabfbc2 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]);
+ }
}
}
}