diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-09-25 20:51:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-25 20:51:51 +0300 |
commit | 814e264521addee62fee40d1357c706688d27119 (patch) | |
tree | 79e3859de150a9abddaf59ad4bc94f67603745b6 /client | |
parent | 1d8633e7e6bc59982395858d0a60b2648c4a5623 (diff) | |
parent | d5cff1ec48bf9ab13a32576e7495ae54c3d2c0f7 (diff) | |
download | wekan-814e264521addee62fee40d1357c706688d27119.tar.gz wekan-814e264521addee62fee40d1357c706688d27119.tar.bz2 wekan-814e264521addee62fee40d1357c706688d27119.zip |
Merge pull request #2720 from whowillcare/master
if username contains space, @ functions will fail at certain point
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; |