32
33
from lp.bugs.mail.newbug import generate_bug_add_email
33
34
from lp.bugs.model.bug import get_also_notified_subscribers
34
35
from lp.registry.interfaces.person import IPerson
36
from lp.registry.interfaces.product import IProduct
35
37
from lp.services.mail.sendmail import (
171
173
level=change.change_level,
172
174
include_master_dupe_subscribers=False))
173
175
recipients.update(change_recipients)
176
# Additionally, if we are re-targetting a bugtask for a private
177
# bug, we need to ensure the new bug supervisor and maintainer are
178
# notified (if they can view the bug).
179
# If they are the same person, only send one notification.
180
if (isinstance(change, BugTaskTargetChange) and
181
old_bugtask is not None and bug_delta.bug.private):
182
bugtask_deltas = bug_delta.bugtask_deltas
183
if not isinstance(bugtask_deltas, (list, tuple)):
184
bugtask_deltas = [bugtask_deltas]
185
for bugtask_delta in bugtask_deltas:
186
if not bugtask_delta.target:
188
new_target = bugtask_delta.bugtask.target
189
if not new_target or not IProduct.providedBy(new_target):
191
if bug_delta.bug.userCanView(new_target.owner):
192
recipients.addMaintainer(new_target.owner)
193
if (new_target.bug_supervisor and not
194
new_target.bug_supervisor.inTeam(new_target.owner) and
195
bug_delta.bug.userCanView(new_target.bug_supervisor)):
196
recipients.addBugSupervisor(
197
new_target.bug_supervisor)
174
198
bug_delta.bug.addChange(change, recipients=recipients)