← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/person-picker-header-803990 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/person-picker-header-803990 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #803990 in Launchpad itself: "person picker in bug reports hides the header for non affiliated people"
  https://bugs.launchpad.net/launchpad/+bug/803990

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/person-picker-header-803990/+merge/68047

This branch fixes the bug task assignee picker when the user has no permission to assign anyone except themselves to the bug task. 

== Implementation ==

The javascript to create the assignee picker was fixed:
- do not hide the steps div (green line) anymore
- if hide_assignee_team_selection is true:
    set step_title to null
    display message to user (as per screenshot)

See screenshot:

http://people.canonical.com/~ianb/bug-assignee-picker.png

== Tests ==

The are no existing yui tests for almost all of what's in bugtask_index.js, including the hide_assignee_team_selection functionality. This functionality was originally tested via windmill. Any new replacement tests should provide the required coverage.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/javascript/bugtask_index.js

-- 
https://code.launchpad.net/~wallyworld/launchpad/person-picker-header-803990/+merge/68047
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/person-picker-header-803990 into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/bugtask_index.js'
--- lib/lp/bugs/javascript/bugtask_index.js	2011-07-06 14:13:04 +0000
+++ lib/lp/bugs/javascript/bugtask_index.js	2011-07-15 06:37:40 +0000
@@ -883,10 +883,15 @@
                     conf.bugtask_path, "getContributorInfo", y_config);
         };
 
-        var step_title =
-            (conf.assignee_vocabulary === 'ValidAssignee') ?
-            "Search for people or teams" :
-            "Select a team of which you are a member";
+        var step_title;
+        if (conf.hide_assignee_team_selection) {
+            step_title = null;
+        } else {
+            step_title =
+                (conf.assignee_vocabulary === 'ValidAssignee') ?
+                "Search for people or teams" :
+                "Select a team of which you are a member";
+        }
         var assignee_picker = Y.lp.app.picker.addPickerPatcher(
             conf.assignee_vocabulary,
             conf.bugtask_path,
@@ -907,8 +912,11 @@
             content_box = assignee_picker.get('contentBox');
             search_box = content_box.one('.yui3-picker-search-box');
             search_box.setStyle('display', 'none');
-            step_title = content_box.one('.contains-steptitle');
-            step_title.setStyle('display', 'none');
+            var info = Y.Node.create('<p style="padding-top: 1em;"></p>')
+                .set('text', 'You may only assign yourself because you are ' +
+                'not affiliated with this project and do not have any team ' +
+                'memberships.');
+            search_box.insert(info, search_box);
         }
         assignee_picker.render();
     }