Merge lp:~stevenk/launchpad/no-more-add-bug-supervisor into lp:launchpad

Proposed by Steve Kowalik on 2012-08-16
Status: Merged
Approved by: Steve Kowalik on 2012-08-16
Approved revision: no longer in the source branch.
Merged at revision: 15815
Proposed branch: lp:~stevenk/launchpad/no-more-add-bug-supervisor
Merge into: lp:launchpad
Diff against target: 98 lines (+2/-48)
3 files modified
lib/lp/bugs/configure.zcml (+1/-1)
lib/lp/bugs/mail/bugnotificationrecipients.py (+1/-23)
lib/lp/bugs/subscribers/bug.py (+0/-24)
To merge this branch: bzr merge lp:~stevenk/launchpad/no-more-add-bug-supervisor
Reviewer Review Type Date Requested Status
Ian Booth (community) 2012-08-16 Approve on 2012-08-16
Review via email: mp+119818@code.launchpad.net

Commit Message

No longer explicitly notify the bug supervisor and maintainer when a private bug is re-targeted, since we have structural subscriptions working for private bugs.

Description of the Change

Now that we have structural subscriptions working for private bugs, we no longer need to explicitly notify the bug supervisor and maintainer when a private bug is re-targeted. This neatly also drops BugNotificationRecipients.add{Maintainer,BugSupervisor}, so I've cleaned them up too.

To post a comment you must log in.
Ian Booth (wallyworld) wrote :

Hooray, less code

review: Approve
Michael Casadevall (mcasadevall) wrote :

Hooray, less bug email!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/configure.zcml'
2--- lib/lp/bugs/configure.zcml 2012-08-07 02:31:56 +0000
3+++ lib/lp/bugs/configure.zcml 2012-08-16 01:00:31 +0000
4@@ -976,7 +976,7 @@
5 <!-- BugNotificationRecipients provides the following
6 attributes/methods in addition. -->
7 <allow
8- attributes="subscription_filters addFilter addBugSupervisor addMaintainer"/>
9+ attributes="subscription_filters addFilter"/>
10 </class>
11 <securedutility
12 provides="lp.bugs.interfaces.bugnotification.IBugNotificationSet"
13
14=== modified file 'lib/lp/bugs/mail/bugnotificationrecipients.py'
15--- lib/lp/bugs/mail/bugnotificationrecipients.py 2012-08-06 03:47:42 +0000
16+++ lib/lp/bugs/mail/bugnotificationrecipients.py 2012-08-16 01:00:31 +0000
17@@ -1,4 +1,4 @@
18-# Copyright 2011 Canonical Ltd. This software is licensed under the
19+# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
20 # GNU Affero General Public License version 3 (see the file LICENSE).
21
22 """Code for handling bug notification recipients in bug mail."""
23@@ -107,28 +107,6 @@
24 text = "are a bug assignee"
25 self._addReason(person, text, reason)
26
27- def addBugSupervisor(self, person):
28- """Registers a bug supervisor of a bugtask's pillar of this bug."""
29- reason = "Bug Supervisor"
30- if person.is_team:
31- text = ("are a member of %s, which is a bug supervisor"
32- % person.displayname)
33- reason += " @%s" % person.name
34- else:
35- text = "are a bug supervisor"
36- self._addReason(person, text, reason)
37-
38- def addMaintainer(self, person):
39- """Registers a maintainer of a bugtask's pillar of this bug."""
40- reason = "Maintainer"
41- if person.is_team:
42- text = ("are a member of %s, which is a maintainer"
43- % person.displayname)
44- reason += " @%s" % person.name
45- else:
46- text = "are a maintainer"
47- self._addReason(person, text, reason)
48-
49 def addStructuralSubscriber(self, person, target):
50 """Registers a structural subscriber to this bug's target."""
51 reason = "Subscriber (%s)" % target.displayname
52
53=== modified file 'lib/lp/bugs/subscribers/bug.py'
54--- lib/lp/bugs/subscribers/bug.py 2012-08-06 03:47:42 +0000
55+++ lib/lp/bugs/subscribers/bug.py 2012-08-16 01:00:31 +0000
56@@ -19,7 +19,6 @@
57 from lp.bugs.adapters.bugchange import (
58 BugDuplicateChange,
59 BugTaskAssigneeChange,
60- BugTaskTargetChange,
61 get_bug_changes,
62 )
63 from lp.bugs.adapters.bugdelta import BugDelta
64@@ -29,7 +28,6 @@
65 from lp.bugs.mail.newbug import generate_bug_add_email
66 from lp.bugs.model.bug import get_also_notified_subscribers
67 from lp.registry.interfaces.person import IPerson
68-from lp.registry.interfaces.product import IProduct
69 from lp.services.config import config
70 from lp.services.database.sqlbase import block_implicit_flushes
71 from lp.services.features import getFeatureFlag
72@@ -176,28 +174,6 @@
73 old_bug=bug_delta.bug_before_modification,
74 level=change.change_level)
75 recipients.update(change_recipients)
76- # Additionally, if we are re-targetting a bugtask for a private
77- # bug, we need to ensure the new bug supervisor and maintainer are
78- # notified (if they can view the bug).
79- # If they are the same person, only send one notification.
80- if (isinstance(change, BugTaskTargetChange) and
81- old_bugtask is not None and bug_delta.bug.private):
82- bugtask_deltas = bug_delta.bugtask_deltas
83- if not isinstance(bugtask_deltas, (list, tuple)):
84- bugtask_deltas = [bugtask_deltas]
85- for bugtask_delta in bugtask_deltas:
86- if not bugtask_delta.target:
87- continue
88- new_target = bugtask_delta.bugtask.target
89- if not new_target or not IProduct.providedBy(new_target):
90- continue
91- if bug_delta.bug.userCanView(new_target.owner):
92- recipients.addMaintainer(new_target.owner)
93- if (new_target.bug_supervisor and not
94- new_target.bug_supervisor.inTeam(new_target.owner) and
95- bug_delta.bug.userCanView(new_target.bug_supervisor)):
96- recipients.addBugSupervisor(
97- new_target.bug_supervisor)
98 bug_delta.bug.addChange(change, recipients=recipients)
99
100