[Python-checkins] r88870 - tracker/instances/python-dev/html/issue.item.js

ezio.melotti python-checkins at python.org
Tue Jul 26 06:57:40 CEST 2011


Author: ezio.melotti
Date: Tue Jul 26 06:57:40 2011
New Revision: 88870

Log:
#390: fix the regex used by the [+] button to better handle extra spaces/commas in the nosy list.

Modified:
   tracker/instances/python-dev/html/issue.item.js

Modified: tracker/instances/python-dev/html/issue.item.js
==============================================================================
--- tracker/instances/python-dev/html/issue.item.js	(original)
+++ tracker/instances/python-dev/html/issue.item.js	Tue Jul 26 06:57:40 2011
@@ -23,7 +23,8 @@
 function add_to_nosy(user) {
     var add_me_button = document.getElementById('add_me_to_nosy');
     var nosy = document.getElementsByName('nosy')[0];
-    var nosy_text = nosy.value.replace(/,\s+/g, ',');
+    // remove spaces at the beginning/end of the string and around the commas
+    var nosy_text = nosy.value.replace(/^[\s,]*|[\s,]*$/g, '').replace(/\s*,\s*/g, ',');
     if (nosy_text == "") {
         // nosy_list is empty, add the user
         nosy.value = user;
@@ -31,7 +32,7 @@
     else {
         re = new RegExp("(^|,)" + user + "(,|$)");
         if (!re.test(nosy_text)) {
-            // make sure the user not in nosy and then add it at the beginning
+            // make sure the user is not in nosy and then add it at the beginning
             nosy.value = user + ',' + nosy_text;
         }
     }


More information about the Python-checkins mailing list