← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mbp/launchpad/323000-affecting-user into lp:launchpad

 

Martin Pool has proposed merging lp:~mbp/launchpad/323000-affecting-user into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #323000 in Launchpad itself: "Make "this bug affects me too" bugs visible from user profile"
  https://bugs.launchpad.net/launchpad/+bug/323000

For more details, see:
https://code.launchpad.net/~mbp/launchpad/323000-affecting-user/+merge/77469

Fix bug 323000 by adding https://bugs.launchpad.net/~/+affectingbugs

Also change the phrasing on that page from "List foo" into just "Foo" in line with general good style for web links.


-- 
https://code.launchpad.net/~mbp/launchpad/323000-affecting-user/+merge/77469
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mbp/launchpad/323000-affecting-user into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/configure.zcml'
--- lib/lp/bugs/browser/configure.zcml	2011-09-02 16:31:43 +0000
+++ lib/lp/bugs/browser/configure.zcml	2011-09-29 07:30:35 +0000
@@ -289,6 +289,13 @@
         permission="zope.Public"
         template="../templates/buglisting-embedded-advanced-search.pt"/>
     <browser:page
+        name="+affectingbugs"
+        for="lp.registry.interfaces.person.IPerson"
+        facet="bugs"
+        class="lp.registry.browser.person.PersonAffectingBugTaskSearchListingView"
+        permission="zope.Public"
+        template="../templates/buglisting-embedded-advanced-search.pt"/>
+    <browser:page
         name="+assignedbugs"
         for="lp.registry.interfaces.person.IPerson"
         facet="bugs"

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2011-09-23 07:49:54 +0000
+++ lib/lp/registry/browser/person.py	2011-09-29 07:30:35 +0000
@@ -861,44 +861,49 @@
 
     usedfor = IPerson
     facet = 'bugs'
-    links = ['assignedbugs', 'commentedbugs', 'reportedbugs',
+    links = ['affectingbugs', 'assignedbugs', 'commentedbugs', 'reportedbugs',
              'subscribedbugs', 'relatedbugs', 'softwarebugs']
 
     def relatedbugs(self):
-        text = 'List all related bugs'
-        summary = ('Lists all bug reports which %s reported, is assigned to, '
+        text = 'All related bugs'
+        summary = ('All bug reports which %s reported, is assigned to, '
                    'or is subscribed to.' % self.context.displayname)
         return Link('', text, site='bugs', summary=summary)
 
     def assignedbugs(self):
-        text = 'List assigned bugs'
-        summary = 'Lists bugs assigned to %s.' % self.context.displayname
+        text = 'Assigned bugs'
+        summary = 'Bugs assigned to %s.' % self.context.displayname
         return Link('+assignedbugs', text, site='bugs', summary=summary)
 
     def softwarebugs(self):
-        text = 'List subscribed packages'
+        text = 'Subscribed packages'
         summary = (
             'A summary report for packages where %s is a bug supervisor.'
             % self.context.displayname)
         return Link('+packagebugs', text, site='bugs', summary=summary)
 
     def reportedbugs(self):
-        text = 'List reported bugs'
-        summary = 'Lists bugs reported by %s.' % self.context.displayname
+        text = 'Reported bugs'
+        summary = 'Bugs reported by %s.' % self.context.displayname
         return Link('+reportedbugs', text, site='bugs', summary=summary)
 
     def subscribedbugs(self):
-        text = 'List subscribed bugs'
-        summary = ('Lists bug reports %s is subscribed to.'
+        text = 'Subscribed bugs'
+        summary = ('Bug reports %s is subscribed to.'
                    % self.context.displayname)
         return Link('+subscribedbugs', text, site='bugs', summary=summary)
 
     def commentedbugs(self):
-        text = 'List commented bugs'
-        summary = ('Lists bug reports on which %s has commented.'
+        text = 'Commented bugs'
+        summary = ('Bug reports on which %s has commented.'
                    % self.context.displayname)
         return Link('+commentedbugs', text, site='bugs', summary=summary)
 
+    def affectingbugs(self):
+        text = 'Affecting bugs'
+        summary = ('Bugs affecting %s.' % self.context.displayname)
+        return Link('+affectingbugs', text, site='bugs', summary=summary)
+
 
 class PersonSpecsMenu(NavigationMenu):
 
@@ -2202,6 +2207,60 @@
         return self.getSearchPageHeading()
 
 
+class PersonAffectingBugTaskSearchListingView(RelevantMilestonesMixin,
+                                             BugTaskSearchListingView):
+    """All bugs affecting someone."""
+
+    columns_to_show = ["id", "summary", "bugtargetdisplayname",
+                       "importance", "status"]
+    view_name = '+affectingbugs'
+    page_title = 'Bugs affecting'   # The context is added externally.
+
+    def searchUnbatched(self, searchtext=None, context=None,
+                        extra_params=None, prejoins=[]):
+        """Return the open bugs assigned to a person."""
+        if context is None:
+            context = self.context
+
+        if extra_params is None:
+            extra_params = dict()
+        else:
+            extra_params = dict(extra_params)
+        extra_params['affected_user'] = context
+
+        sup = super(PersonAffectingBugTaskSearchListingView, self)
+        return sup.searchUnbatched(
+            searchtext, context, extra_params, prejoins)
+
+    def shouldShowAssigneeWidget(self):
+        """Should the assignee widget be shown on the advanced search page?"""
+        return False
+
+    def shouldShowTeamPortlet(self):
+        """Should the team assigned bugs portlet be shown?"""
+        return True
+
+    def shouldShowTagsCombinatorWidget(self):
+        """Should the tags combinator widget show on the search page?"""
+        return False
+
+    def getSearchPageHeading(self):
+        """The header for the search page."""
+        return "Bugs affecting %s" % self.context.displayname
+
+    def getAdvancedSearchButtonLabel(self):
+        """The Search button for the advanced search page."""
+        return "Search bugs affecting %s" % self.context.displayname
+
+    def getSimpleSearchURL(self):
+        """Return a URL that can be used as an href to the simple search."""
+        return canonical_url(self.context, view_name=self.view_name)
+
+    @property
+    def label(self):
+        return self.getSearchPageHeading()
+
+
 class PersonAssignedBugTaskSearchListingView(RelevantMilestonesMixin,
                                              BugTaskSearchListingView):
     """All bugs assigned to someone."""

=== modified file 'lib/lp/registry/browser/tests/test_person_view.py'
--- lib/lp/registry/browser/tests/test_person_view.py	2011-09-23 07:49:54 +0000
+++ lib/lp/registry/browser/tests/test_person_view.py	2011-09-29 07:30:35 +0000
@@ -1133,3 +1133,18 @@
             self.subscribed_bug.default_bugtask,
             self.owned_bug.default_bugtask,
             ]
+
+
+class TestPersonAffectingBugTaskSearchListingView(
+    BugTaskViewsTestBase, TestCaseWithFactory):
+    """Tests for PersonAffectingBugTaskSearchListingView."""
+
+    view_name = '+affectingbugs'
+
+    def setUp(self):
+        super(TestPersonAffectingBugTaskSearchListingView, self).setUp()
+        # Bugs filed by this user are marked as affecting them by default, so
+        # the bug we filed is returned.
+        self.expected_for_search_unbatched = [
+            self.owned_bug.default_bugtask,
+            ]


Follow ups