← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/launchpad/bug-799900 into lp:launchpad

 

Brad Crittenden has proposed merging lp:~bac/launchpad/bug-799900 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #799900 in Launchpad itself: "No display name truncation in subscriber list"
  https://bugs.launchpad.net/launchpad/+bug/799900

For more details, see:
https://code.launchpad.net/~bac/launchpad/bug-799900/+merge/68452

= Summary =

Before the bug subscription work was done, user and team display names shown in the subscriber list were truncated to 20 characters.  The new work omitted that truncation but it is desirable.

== Proposed fix ==

Truncate the display name to 20 characters.  Just lop it off.  No ellipsis or anything.  Unfriendly?

== Pre-implementation notes ==

IRC with Gary

== Implementation details ==

As above

== Tests ==

Load up lib/lp/bugs/javascript/tests/test_subscribers_list.html in your browser of choice.

== Demo and Q/A ==

On launchpad.dev, log in as Sample Person.  Change display name to something absurdly long.  Log out and then log in as someone else.  Visit Bug 1.  Note that the super long name is now not so long.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/javascript/subscribers_list.js
  lib/lp/bugs/javascript/tests/test_subscribers_list.js
-- 
https://code.launchpad.net/~bac/launchpad/bug-799900/+merge/68452
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-799900 into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/subscribers_list.js'
--- lib/lp/bugs/javascript/subscribers_list.js	2011-07-01 14:31:37 +0000
+++ lib/lp/bugs/javascript/subscribers_list.js	2011-07-19 20:01:43 +0000
@@ -697,7 +697,7 @@
 
     var subscriber_text = Y.Node.create('<span />')
         .addClass('sprite')
-        .set('text', subscriber.display_name);
+        .set('text', subscriber.display_name.substring(0, 20));
     if (subscriber.is_team === true) {
         subscriber_text.addClass('team');
     } else {

=== modified file 'lib/lp/bugs/javascript/tests/test_subscribers_list.js'
--- lib/lp/bugs/javascript/tests/test_subscribers_list.js	2011-07-01 10:19:20 +0000
+++ lib/lp/bugs/javascript/tests/test_subscribers_list.js	2011-07-19 20:01:43 +0000
@@ -794,6 +794,20 @@
         Y.Assert.isTrue(text.hasClass('person'));
     },
 
+    test_createSubscriberNodeDisplayNameTruncated: function() {
+        // The display name displayed should be truncted to 20 characters.
+        var subscribers_list = setUpSubscribersList(this.root);
+        var subscriber = {
+            name: 'user',
+            display_name: 'Really Really Long Name',
+            web_link: 'http://launchpad.net/~user'
+        };
+        var node = subscribers_list._createSubscriberNode(subscriber);
+        var link = node.one('a');
+        var text = link.one('span');
+        Y.Assert.areEqual('Really Really Long N', text.get('text'));
+    },
+
     test_createSubscriberNode_team: function() {
         // When passed a subscriber object which has is_team === true,
         // a constructed node uses a 'sprite team' CSS classes instead