← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/remove-unused-sharing-functions into lp:launchpad

 

j.c.sackett has proposed merging lp:~jcsackett/launchpad/remove-unused-sharing-functions into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1009720 in Launchpad itself: "Bug.getRequiredSubscribers and Bug.getAutoRemovedSubscribers aren't used and should be removed"
  https://bugs.launchpad.net/launchpad/+bug/1009720

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/remove-unused-sharing-functions/+merge/109030

Summary
=======
Quite some time ago, the `reconcileSubscribers` method was removed from the
bug model, as it was never used. It used two methods, `getRequiredSubscribers`
and `getAutoRemovedSubscribers`, which were unused anywhere else. As a matter
of pure oversight, these weren't deleted.

Now they are.

Implementation
==============
The methods `reconcileSubscribers` and `getAutoRemovedSubscribers` are removed
from the bug model.

Tests
=====
You don't actually need to run any tests--these were literally not called
anywhere. Just in case though: bin/test -vvct bug

QA
==
No QA. This just kills old unused code.

LoC
===
This only removes code.

Lint
====

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/model/bug.py
-- 
https://code.launchpad.net/~jcsackett/launchpad/remove-unused-sharing-functions/+merge/109030
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/remove-unused-sharing-functions into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py	2012-06-05 02:03:44 +0000
+++ lib/lp/bugs/model/bug.py	2012-06-06 20:44:02 +0000
@@ -1816,63 +1816,6 @@
 
         return True
 
-    def getRequiredSubscribers(self, information_type, who):
-        """Return the mandatory subscribers for a bug with given attributes.
-
-        When a bug is marked as private or security related, it is required
-        that certain people be subscribed so they can access details about the
-        bug. The rules are:
-            security=true, private=true/false ->
-                subscribers = the reporter + security contact for each task
-            security=false, private=true ->
-                subscribers = the reporter + bug supervisor for each task
-            security=false, private=false ->
-                subscribers = ()
-
-        If bug supervisor or security contact is unset, fallback to bugtask
-        reporter/owner.
-        """
-        if information_type == InformationType.PUBLIC:
-            return set()
-        result = set()
-        result.add(self.owner)
-        for bugtask in self.bugtasks:
-            maintainer = bugtask.pillar.owner
-            if information_type in SECURITY_INFORMATION_TYPES:
-                result.add(bugtask.pillar.security_contact or maintainer)
-            if information_type in PRIVATE_INFORMATION_TYPES:
-                result.add(bugtask.pillar.bug_supervisor or maintainer)
-        if information_type in PRIVATE_INFORMATION_TYPES:
-            subscribers_for_who = self.getSubscribersForPerson(who)
-            if subscribers_for_who.is_empty():
-                result.add(who)
-        return result
-
-    def getAutoRemovedSubscribers(self, information_type):
-        """Return the to be removed subscribers for bug with given attributes.
-
-        When a bug's privacy or security related attributes change, some
-        existing subscribers may need to be automatically removed.
-        The rules are:
-            security=false ->
-                auto removed subscribers = (bugtask security contacts)
-            privacy=false ->
-                auto removed subscribers = (bugtask bug supervisors)
-
-        """
-        bug_supervisors = []
-        security_contacts = []
-        for_security_related = information_type in SECURITY_INFORMATION_TYPES
-        for_private = information_type in PRIVATE_INFORMATION_TYPES
-        for pillar in self.affected_pillars:
-            if (self.security_related and not for_security_related
-                and pillar.security_contact):
-                    security_contacts.append(pillar.security_contact)
-            if (self.private and not for_private
-                and pillar.bug_supervisor):
-                    bug_supervisors.append(pillar.bug_supervisor)
-        return bug_supervisors, security_contacts
-
     def getBugTask(self, target):
         """See `IBug`."""
         for bugtask in self.bugtasks:


Follow ups