Browse Source

Usernames should be able to include dots (.)

Jonas Oberg 7 years ago
parent
commit
fe5ea60847
3 changed files with 4 additions and 4 deletions
  1. 1 1
      client/components/lists/listBody.js
  2. 2 2
      client/components/main/editor.js
  3. 1 1
      sandstorm.js

+ 1 - 1
client/components/lists/listBody.js

@@ -180,7 +180,7 @@ BlazeComponent.extendComponent({
     $textarea.escapeableTextComplete([
       // User mentions
       {
-        match: /\B@(\w*)$/,
+        match: /\B@([\w.]*)$/,
         search(term, callback) {
           const currentBoard = Boards.findOne(Session.get('currentBoard'));
           callback($.map(currentBoard.activeMembers(), (member) => {

+ 2 - 2
client/components/main/editor.js

@@ -25,7 +25,7 @@ Template.editor.onRendered(() => {
 
     // User mentions
     {
-      match: /\B@(\w*)$/,
+      match: /\B@([\w.]*)$/,
       search(term, callback) {
         const currentBoard = Boards.findOne(Session.get('currentBoard'));
         callback(currentBoard.activeMembers().map((member) => {
@@ -60,7 +60,7 @@ Blaze.Template.registerHelper('mentions', new Template('mentions', function() {
     member.username = Users.findOne(member.userId).username;
     return member;
   });
-  const mentionRegex = /\B@(\w*)/gi;
+  const mentionRegex = /\B@([\w.]*)/gi;
   let content = Blaze.toHTML(view.templateContentBlock);
 
   let currentMention;

+ 1 - 1
sandstorm.js

@@ -188,7 +188,7 @@ if (isSandstorm && Meteor.isServer) {
             caption = { defaultText: comment.text };
             const activeMembers =
               _.pluck(Boards.findOne(sandstormBoard._id).activeMembers(), 'userId');
-            (comment.text.match(/\B@(\w*)/g) || []).forEach((username) => {
+            (comment.text.match(/\B@([\w.]*)/g) || []).forEach((username) => {
               const user = Meteor.users.findOne({ username: username.slice(1)});
               if (user && activeMembers.indexOf(user._id) !== -1) {
                 mentionedUser(user._id);