← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/no-implicit-assignee-visibility into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/no-implicit-assignee-visibility into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/no-implicit-assignee-visibility/+merge/104317

This branch rips out the implicit bug assignee visibility rules. This will be reimplemented later by mandating that assignees have grants, but it's easier and less disruptive to just remove it for now.

It's already been disabled in bug searches for a week without anybody noticing.
-- 
https://code.launchpad.net/~wgrant/launchpad/no-implicit-assignee-visibility/+merge/104317
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/no-implicit-assignee-visibility into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2012-04-18 01:37:38 +0000
+++ lib/lp/bugs/model/bugtask.py	2012-05-02 04:12:20 +0000
@@ -1055,28 +1055,16 @@
                 'their teams. Only project owners, bug supervisors, drivers '
                 'and release managers can assign others.')
 
-        now = datetime.datetime.now(pytz.UTC)
         if self.assignee and not assignee:
             # The assignee is being cleared, so clear the date_assigned
             # value.
             self.date_assigned = None
-            # The bugtask is unassigned, so clear the _known_viewer cached
-            # property for the bug. Retain the current assignee as a viewer so
-            # that they are able to unassign themselves and get confirmation
-            # that that worked.
-            get_property_cache(self.bug)._known_viewers = set(
-                [self.assignee.id])
         if not self.assignee and assignee:
             # The task is going from not having an assignee to having
             # one, so record when this happened
-            self.date_assigned = now
+            self.date_assigned = datetime.datetime.now(pytz.UTC)
 
         self.assignee = assignee
-        # Invalidate the old visibility cache for this bug and replace it with
-        # the new assignee.
-        if self.assignee is not None:
-            get_property_cache(self.bug)._known_viewers = set(
-                [self.assignee.id])
 
     def validateTransitionToTarget(self, target):
         """See `IBugTask`."""

=== modified file 'lib/lp/bugs/model/bugtasksearch.py'
--- lib/lp/bugs/model/bugtasksearch.py	2012-05-01 07:28:49 +0000
+++ lib/lp/bugs/model/bugtasksearch.py	2012-05-02 04:12:20 +0000
@@ -1452,11 +1452,6 @@
                 FROM BugSubscription
                 WHERE BugSubscription.person IN (SELECT team FROM teams) AND
                     BugSubscription.bug = Bug.id
-                UNION ALL
-                SELECT BugTask.bug
-                FROM BugTask
-                WHERE BugTask.assignee IN (SELECT team FROM teams) AND
-                    BugTask.bug = Bug.id
                 )
             """ % user.id)
     if not private_only:

=== modified file 'lib/lp/bugs/tests/test_bugvisibility.py'
--- lib/lp/bugs/tests/test_bugvisibility.py	2012-04-19 21:15:25 +0000
+++ lib/lp/bugs/tests/test_bugvisibility.py	2012-05-02 04:12:20 +0000
@@ -76,13 +76,6 @@
             self.bug.subscribe(user, self.owner)
         self.assertTrue(self.bug.userCanView(user))
 
-    def test_privateBugAssignee(self):
-        # The bug assignee can see the private bug.
-        bug_assignee = self.factory.makePerson(name="bugassignee")
-        with celebrity_logged_in('admin'):
-            self.bug.default_bugtask.transitionToAssignee(bug_assignee)
-        self.assertTrue(self.bug.userCanView(bug_assignee))
-
     def test_publicBugAnonUser(self):
         # Since the bug is private, the anonymous user cannot see it.
         self.assertFalse(self.bug.userCanView(None))


Follow ups