diff options
author | Sam X. Chen <sam.xi.chen@gmail.com> | 2019-09-19 15:16:48 -0400 |
---|---|---|
committer | Sam X. Chen <sam.xi.chen@gmail.com> | 2019-09-19 15:16:48 -0400 |
commit | 4ee88e026e86ab26757d46c9dadffa5005a7740f (patch) | |
tree | a6a51a798716f1a682f2fe8937f4ed77f6630937 /client | |
parent | f29d7daa1d687df535a7c6ac5c53cc6f067c44cb (diff) | |
download | wekan-4ee88e026e86ab26757d46c9dadffa5005a7740f.tar.gz wekan-4ee88e026e86ab26757d46c9dadffa5005a7740f.tar.bz2 wekan-4ee88e026e86ab26757d46c9dadffa5005a7740f.zip |
Buxfixed: if username contains space, it will cause @ commment failed to send out email and other
Diffstat (limited to 'client')
-rwxr-xr-x | client/components/main/editor.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js index b1725227..39c03aa9 100755 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -94,7 +94,13 @@ Template.editor.onRendered(() => { currentBoard .activeMembers() .map(member => { - const username = Users.findOne(member.userId).username; + const user = Users.findOne(member.userId); + if (user._id === Meteor.userId()) { + return null; + } + const value = user.username; + const username = + value && value.match(/\s+/) ? `"${value}"` : value; return username.includes(term) ? username : null; }) .filter(Boolean), @@ -120,9 +126,10 @@ Template.editor.onRendered(() => { ? [ ['view', ['fullscreen']], ['table', ['table']], - ['font', ['bold', 'underline']], - //['fontsize', ['fontsize']], + ['font', ['bold']], ['color', ['color']], + ['insert', ['video']], // iframe tag will be sanitized TODO if iframe[class=note-video-clip] can be added into safe list, insert video can be enabled + //['fontsize', ['fontsize']], ] : [ ['style', ['style']], @@ -345,11 +352,12 @@ Blaze.Template.registerHelper( } return member; }); - const mentionRegex = /\B@([\w.]*)/gi; + const mentionRegex = /\B@(?:(?:"([\w.\s]*)")|([\w.]+))/gi; // including space in username let currentMention; while ((currentMention = mentionRegex.exec(content)) !== null) { - const [fullMention, username] = currentMention; + const [fullMention, quoteduser, simple] = currentMention; + const username = quoteduser || simple; const knowedUser = _.findWhere(knowedUsers, { username }); if (!knowedUser) { continue; |