← Back to team overview

launchpad-reviewers team mailing list archive

lp:~wallyworld/launchpad/incorrect-branch-query-private-column-871518 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/incorrect-branch-query-private-column-871518 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #871518 in Launchpad itself: "Incorrect branch column 'private' used in query for person's branches"
  https://bugs.launchpad.net/launchpad/+bug/871518

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/incorrect-branch-query-private-column-871518/+merge/78786

== Implementation ==

The previous work to add the branch transitively_private column missed one case where the private column was being used in a query.

== Tests ==

Tweak an existing test to fail unless the proper column is used.
TestGenericBranchCollectionVisibleFilter.test_owner_member_sees_own_branches()

== Lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/model/branchcollection.py
  lib/lp/code/model/tests/test_branchcollection.py

-- 
https://code.launchpad.net/~wallyworld/launchpad/incorrect-branch-query-private-column-871518/+merge/78786
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/incorrect-branch-query-private-column-871518 into lp:launchpad.
=== modified file 'lib/lp/code/model/branchcollection.py'
--- lib/lp/code/model/branchcollection.py	2011-09-14 10:19:43 +0000
+++ lib/lp/code/model/branchcollection.py	2011-10-10 00:17:25 +0000
@@ -811,7 +811,7 @@
             Select(Branch.id,
                    And(Branch.owner == TeamParticipation.teamID,
                        TeamParticipation.person == person,
-                       Branch.explicitly_private == True)),
+                       Branch.transitively_private == True)),
             # Private branches the person is subscribed to, either directly or
             # indirectly.
             Select(Branch.id,

=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
--- lib/lp/code/model/tests/test_branchcollection.py	2011-09-28 23:26:44 +0000
+++ lib/lp/code/model/tests/test_branchcollection.py	2011-10-10 00:17:25 +0000
@@ -585,7 +585,9 @@
         team_owner = self.factory.makePerson()
         team = self.factory.makeTeam(team_owner)
         private_branch = self.factory.makeAnyBranch(
-            owner=team, private=True, name='team')
+            owner=team, stacked_on=self.private_stacked_on_branch,
+            name='team')
+        removeSecurityProxy(private_branch).unsubscribe(team, team_owner)
         branches = self.all_branches.visibleByUser(team_owner)
         self.assertEqual(
             sorted([self.public_branch, private_branch]),