← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/fix-assignment-list into lp:launchpad

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/fix-assignment-list into lp:launchpad.

Commit message:
Fix person page assigned spec listings.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1072981 in Launchpad itself: "Blueprints showing up as assigned on profile even though I'm only subscribed"
  https://bugs.launchpad.net/launchpad/+bug/1072981

For more details, see:
https://code.launchpad.net/~abentley/launchpad/fix-assignment-list/+merge/132621

= Summary =
Fix bug #1072981: Blueprints showing up as assigned on profile even though I'm only subscribed Edit

== Proposed fix ==
Limit listings to only assigned specifications.

== Pre-implementation notes ==
None

== LOC Rationale ==
Part of Private Projects

== Implementation details ==
Updated findVisibleAssignedInProgressSpecs to actually ensure that *assigned* specs were listed, rather than arbitrarily-related specs.

== Tests ==
bin/test -t test_only_assigned_blueprints

== Demo and Q/A ==
Create a specification, subscribe to it, set yourself as the approver and drafter, and set its implementation status to "STARTED".  It should not be listed on your overview page (*.launchpad.net/~) under "Assigned blueprints".  Assign it to yourself.  It should be listed under "Assigned blueprints".


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/browser/tests/test_person.py
  lib/lp/registry/model/person.py
-- 
https://code.launchpad.net/~abentley/launchpad/fix-assignment-list/+merge/132621
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/fix-assignment-list into lp:launchpad.
=== modified file 'lib/lp/registry/browser/tests/test_person.py'
--- lib/lp/registry/browser/tests/test_person.py	2012-10-26 07:15:49 +0000
+++ lib/lp/registry/browser/tests/test_person.py	2012-11-01 20:45:25 +0000
@@ -75,7 +75,7 @@
 from lp.testing.pages import (
     extract_text,
     setupBrowserForUser,
-    find_tags_by_class)
+    )
 from lp.testing.views import (
     create_initialized_view,
     create_view,
@@ -220,6 +220,18 @@
         self.assertIn(public_spec.name, browser.contents)
         self.assertNotIn(private_spec.name, browser.contents)
 
+    def test_only_assigned_blueprints(self):
+        # Only assigned blueprints are listed, not arbitrary related
+        # blueprints
+        person = self.factory.makePerson()
+        spec = self.factory.makeSpecification(
+            implementation_status=SpecificationImplementationStatus.STARTED,
+            owner=person, drafter=person, approver=person)
+        spec.subscribe(person)
+        with person_logged_in(None):
+            browser = self.getViewBrowser(person)
+        self.assertNotIn(spec.name, browser.contents)
+
 
 class TestPersonViewKarma(TestCaseWithFactory):
 

=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2012-10-26 18:23:39 +0000
+++ lib/lp/registry/model/person.py	2012-11-01 20:45:25 +0000
@@ -802,7 +802,8 @@
     def findVisibleAssignedInProgressSpecs(self, user):
         """See `IPerson`."""
         return self.specifications(user, in_progress=True, quantity=5,
-                                   sort=Desc(Specification.date_started))
+                                   sort=Desc(Specification.date_started),
+                                   filter=[SpecificationFilter.ASSIGNEE])
 
     @property
     def unique_displayname(self):


Follow ups