← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~huwshimi/launchpad/tag-field-space-394342 into lp:launchpad

 

Huw Wilkins has proposed merging lp:~huwshimi/launchpad/tag-field-space-394342 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #394342 Tags field contains a stray space by default
  https://bugs.launchpad.net/bugs/394342

For more details, see:
https://code.launchpad.net/~huwshimi/launchpad/tag-field-space-394342/+merge/49342

Removed initial space character from bug tag field when editing and there are no tags.

TO TEST:
View a bug that has no tags. Click "Add tags". The field should be completely empty (used to contain a single space character).
-- 
https://code.launchpad.net/~huwshimi/launchpad/tag-field-space-394342/+merge/49342
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~huwshimi/launchpad/tag-field-space-394342 into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/bug_tags_entry.js'
--- lib/lp/bugs/javascript/bug_tags_entry.js	2011-02-08 03:15:37 +0000
+++ lib/lp/bugs/javascript/bug_tags_entry.js	2011-02-11 05:09:35 +0000
@@ -46,8 +46,14 @@
     tag_list_span.all(A).each(function(anchor) {
         tags.push(anchor.get(INNER_HTML));
     });
-
-    tag_input.set(VALUE, tags.join(' ') + ' ');
+    
+    var tag_list = tags.join(' ');
+    /* If there are tags then add a space to the end of the sting so the user 
+       doesn't have to type one. */
+    if (tag_list != "") {
+        tag_list += ' '
+    }
+    tag_input.set(VALUE, tag_list);
 };
 
 /**