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

Proposed by Aaron Bentley
Status: Merged
Approved by: j.c.sackett
Approved revision: no longer in the source branch.
Merged at revision: 16228
Proposed branch: lp:~abentley/launchpad/fix-assignment-list
Merge into: lp:launchpad
Diff against target: 45 lines (+15/-2)
2 files modified
lib/lp/registry/browser/tests/test_person.py (+13/-1)
lib/lp/registry/model/person.py (+2/-1)
To merge this branch: bzr merge lp:~abentley/launchpad/fix-assignment-list
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+132621@code.launchpad.net

Commit message

Fix person page assigned spec listings.

Description of the change

= 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

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

Looks fine. Thanks, Aaron.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/tests/test_person.py'
2--- lib/lp/registry/browser/tests/test_person.py 2012-10-26 07:15:49 +0000
3+++ lib/lp/registry/browser/tests/test_person.py 2012-11-01 20:45:25 +0000
4@@ -75,7 +75,7 @@
5 from lp.testing.pages import (
6 extract_text,
7 setupBrowserForUser,
8- find_tags_by_class)
9+ )
10 from lp.testing.views import (
11 create_initialized_view,
12 create_view,
13@@ -220,6 +220,18 @@
14 self.assertIn(public_spec.name, browser.contents)
15 self.assertNotIn(private_spec.name, browser.contents)
16
17+ def test_only_assigned_blueprints(self):
18+ # Only assigned blueprints are listed, not arbitrary related
19+ # blueprints
20+ person = self.factory.makePerson()
21+ spec = self.factory.makeSpecification(
22+ implementation_status=SpecificationImplementationStatus.STARTED,
23+ owner=person, drafter=person, approver=person)
24+ spec.subscribe(person)
25+ with person_logged_in(None):
26+ browser = self.getViewBrowser(person)
27+ self.assertNotIn(spec.name, browser.contents)
28+
29
30 class TestPersonViewKarma(TestCaseWithFactory):
31
32
33=== modified file 'lib/lp/registry/model/person.py'
34--- lib/lp/registry/model/person.py 2012-10-26 18:23:39 +0000
35+++ lib/lp/registry/model/person.py 2012-11-01 20:45:25 +0000
36@@ -802,7 +802,8 @@
37 def findVisibleAssignedInProgressSpecs(self, user):
38 """See `IPerson`."""
39 return self.specifications(user, in_progress=True, quantity=5,
40- sort=Desc(Specification.date_started))
41+ sort=Desc(Specification.date_started),
42+ filter=[SpecificationFilter.ASSIGNEE])
43
44 @property
45 def unique_displayname(self):