launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05409
[Merge] lp:~rvb/launchpad/assign-bug-843415 into lp:launchpad
Raphaël Badin has proposed merging lp:~rvb/launchpad/assign-bug-843415 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #843415 in Launchpad itself: "Can't assign people on bugs that affect many projects"
https://bugs.launchpad.net/launchpad/+bug/843415
For more details, see:
https://code.launchpad.net/~rvb/launchpad/assign-bug-843415/+merge/81138
This branch adds an edit button next to the assignee of each bugtask when a bug has more than 10 bugtasks. (This is done with a dynamically added js picker when the bug has less than 10 bugtasks)
= Tests =
./bin/test -vvc test_bugnomination test_assignee_edit_link_no_user_no_link
./bin/test -vvc test_bugnomination test_assignee_edit_link_with_many_bugtasks
./bin/test -vvc test_bugnomination test_assignee_edit_link_with_only_a_few_bugtasks
= Q/A =
Make sure that this bug:
https://bugs.qastaging.launchpad.net/gcc-linaro/+bug/736661 now has the edit link next to each assignee.
--
https://code.launchpad.net/~rvb/launchpad/assign-bug-843415/+merge/81138
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/assign-bug-843415 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/tests/test_bugnomination.py'
--- lib/lp/bugs/browser/tests/test_bugnomination.py 2011-10-03 15:13:19 +0000
+++ lib/lp/bugs/browser/tests/test_bugnomination.py 2011-11-03 12:15:57 +0000
@@ -7,6 +7,9 @@
from zope.component import getUtility
+import soupmatchers
+import re
+from testtools.matchers import Not
from canonical.testing.layers import DatabaseFunctionalLayer
from canonical.launchpad.webapp.interaction import get_current_principal
from canonical.launchpad.webapp.interfaces import (
@@ -145,6 +148,56 @@
self.assertEqual(0, len(view.request.notifications))
+class TestBugEditLinks(TestCaseWithFactory):
+
+ layer = DatabaseFunctionalLayer
+
+ edit_link_matcher = soupmatchers.HTMLContains(
+ soupmatchers.Tag(
+ 'Edit link', 'a',
+ attrs={'class': 'assignee-edit',
+ 'href': re.compile('\+editstatus$')}))
+
+ def _createBug(self, bug_task_number=1):
+ series = self.factory.makeProductSeries()
+ bug = self.factory.makeBug(series=series)
+ for i in range(bug_task_number):
+ self.factory.makeBugTask(bug=bug)
+ launchbag = getUtility(ILaunchBag)
+ launchbag.add(series.product)
+ launchbag.add(bug)
+ launchbag.add(bug.default_bugtask)
+ return bug
+
+ def test_assignee_edit_link_with_many_bugtasks(self):
+ # When the number of bug tasks is >= 10, a link should be
+ # displayed to edit the assignee.
+ bug = self._createBug(11)
+ with person_logged_in(bug.owner):
+ page = create_initialized_view(
+ bug, name='+bugtasks-and-nominations-table',
+ principal=bug.owner).render()
+ self.assertThat(page, self.edit_link_matcher)
+
+ def test_assignee_edit_link_with_only_a_few_bugtasks(self):
+ # When the number of bug tasks is < 10, editing the assignee is
+ # done with a js picker.
+ bug = self._createBug(3)
+ with person_logged_in(bug.owner):
+ page = create_initialized_view(
+ bug, name='+bugtasks-and-nominations-table',
+ principal=bug.owner).render()
+ self.assertThat(page, Not(self.edit_link_matcher))
+
+ def test_assignee_edit_link_no_user_no_link(self):
+ # No link is displayed when the request is from an anonymous
+ # user.
+ bug = self._createBug(11)
+ page = create_initialized_view(
+ bug, name='+bugtasks-and-nominations-table').render()
+ self.assertThat(page, Not(self.edit_link_matcher))
+
+
class TestBugNominationEditView(TestCaseWithFactory):
"""Tests for BugNominationEditView."""
=== modified file 'lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt'
--- lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt 2011-08-19 08:55:04 +0000
+++ lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt 2011-11-03 12:15:57 +0000
@@ -129,6 +129,13 @@
Unassigned
</tal:unassigned>
</span>
+ <a class="assignee-edit"
+ tal:condition="python: view.many_bugtasks and
+ view.user_can_edit_assignee"
+ href="+editstatus"
+ tal:attributes="href data/edit_link">
+ <img class="editicon" src="/@@/edit" />
+ </a>
<button class="lazr-btn yui3-activator-act yui3-activator-hidden">
Edit
</button>