allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] 03/07: [#8282] Add comment lines and improve Regex for matching -
Date Tue, 04 Jun 2019 15:14:39 GMT
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 49dbcb54240681e71e36c0f237be109c2a675541
Author: Shalitha Suranga <shalithasuranga@gmail.com>
AuthorDate: Sun Jun 2 19:57:47 2019 +0530

    [#8282] Add comment lines and improve Regex for matching -
---
 Allura/allura/lib/widgets/resources/js/usermentions-helper.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/lib/widgets/resources/js/usermentions-helper.js b/Allura/allura/lib/widgets/resources/js/usermentions-helper.js
index e0724d2..97c3895 100644
--- a/Allura/allura/lib/widgets/resources/js/usermentions-helper.js
+++ b/Allura/allura/lib/widgets/resources/js/usermentions-helper.js
@@ -31,7 +31,7 @@ var getProjectUsers = function(users_url) {
 }
 
 CodeMirror.registerHelper('hint', 'alluraUserMentions', function (editor) {
-    var word = /[\w$]+/;
+    var word = /[\w-]+/;
     var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
     var tokenType = editor.getTokenTypeAt(cur);
 
@@ -39,16 +39,20 @@ CodeMirror.registerHelper('hint', 'alluraUserMentions', function (editor)
{
         return;
 
     var end = cur.ch, start = end;
+    // Find the starting position of currently typed word and set it to 'start' var
     while (start && word.test(curLine.charAt(start - 1))) --start;
+    // Extract the current word from the current line using 'start' / 'end' value pair
     var curWord = start != end && curLine.slice(start, end);
     var list = [];
     if(curWord) {
+        // If there is current word set, We can filter out users from the main list and display
them
         userMentionList.forEach(function(item) {
             if(item.displayText.indexOf(curWord) != -1)
                 list.push(item);
         });
     }
     else {
+        // Otherwise, we display the entire list
         list = userMentionList.slice(); 
     }
 


Mime
View raw message