Merge lp:~brian-murray/launchpad/bug-605340 into lp:launchpad

Proposed by Brian Murray
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 11255
Proposed branch: lp:~brian-murray/launchpad/bug-605340
Merge into: lp:launchpad
Diff against target: 68 lines (+15/-5)
3 files modified
lib/canonical/launchpad/mailnotification.py (+1/-1)
lib/lp/bugs/doc/bugnotification-email.txt (+3/-1)
lib/lp/bugs/mail/bugnotificationbuilder.py (+11/-3)
To merge this branch: bzr merge lp:~brian-murray/launchpad/bug-605340
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve
Review via email: mp+31221@code.launchpad.net

Commit message

Add in an X-Launchpad-Bug-Modifier header to all bug mail that displays the creator's display name and name.

Description of the change

= Summary =

From bug 605340:

"The last launchpad rollout fixed bug 111147, no longer exposing the email address of people who have hidden them in the launchpad interface. The unfortunate side effect of this is that there's now no programmatic way to go from an emailed comment back to the either the identity of the commenter or the specific comment on the bug report."

Depending on what the final decision to do with the From: address is determining the commenter or player (if you will), will be even more problematic.

== Proposed fix ==

Add in an X-Launchpad-Bug-Modifier header to all bug mail that displays the player's display name and name.

== Tests ==

bin/test -cvv -t bugnotification-email

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks! I'm actually one of the people affected by this bug, I have a sieve rule that automatically marks my own comments as read.

The event_creator attribute is set but not used anywhere. Is it really necessary ?

The comment on line 57 lacks an ending dot, to be really pedantic.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/mailnotification.py'
2--- lib/canonical/launchpad/mailnotification.py 2010-06-24 10:12:01 +0000
3+++ lib/canonical/launchpad/mailnotification.py 2010-07-29 16:47:49 +0000
4@@ -94,7 +94,7 @@
5 references = [bug.initial_message.rfc822msgid]
6 recipients = bug.getBugNotificationRecipients()
7
8- bug_notification_builder = BugNotificationBuilder(bug)
9+ bug_notification_builder = BugNotificationBuilder(bug, event_creator)
10 for to_addr in sorted(to_addrs):
11 reason, rationale = recipients.getReason(to_addr)
12 subject, contents = generate_bug_add_email(
13
14=== modified file 'lib/lp/bugs/doc/bugnotification-email.txt'
15--- lib/lp/bugs/doc/bugnotification-email.txt 2010-06-24 10:12:01 +0000
16+++ lib/lp/bugs/doc/bugnotification-email.txt 2010-07-29 16:47:49 +0000
17@@ -495,7 +495,8 @@
18 When instantiatiated it derives a list of common unchanging headers
19 from the bug so that they are not calculated for every recipient.
20
21- >>> bug_four_notification_builder = BugNotificationBuilder(bug_four)
22+ >>> bug_four_notification_builder = BugNotificationBuilder(bug_four,
23+ ... private_person)
24 >>> for header in bug_four_notification_builder.common_headers:
25 ... print ': '.join(header)
26 Reply-To: Bug 4 <4@bugs.launchpad.net>
27@@ -506,6 +507,7 @@
28 X-Launchpad-Bug-Security-Vulnerability: yes
29 X-Launchpad-Bug-Commenters: name12
30 X-Launchpad-Bug-Reporter: Sample Person (name12)
31+ X-Launchpad-Bug-Modifier: Ford Prefect (person-name...)
32
33 The build() method of a builder accepts a number of parameters and
34 returns an instance of email.MIMEText. The most basic invocation of
35
36=== modified file 'lib/lp/bugs/mail/bugnotificationbuilder.py'
37--- lib/lp/bugs/mail/bugnotificationbuilder.py 2010-06-24 10:12:01 +0000
38+++ lib/lp/bugs/mail/bugnotificationbuilder.py 2010-07-29 16:47:49 +0000
39@@ -91,7 +91,7 @@
40 up-front.
41 """
42
43- def __init__(self, bug):
44+ def __init__(self, bug, event_creator=None):
45 self.bug = bug
46
47 # Pre-calculate common headers.
48@@ -137,10 +137,18 @@
49 ('X-Launchpad-Bug-Commenters', ' '.join(sorted(commenters))))
50
51 # Add the -Bug-Reporter header to identify the owner of the bug
52- # and the original bug task for filtering
53+ # and the original bug task for filtering.
54 self.common_headers.append(
55 ('X-Launchpad-Bug-Reporter',
56- '%s (%s)' % ( bug.owner.displayname, bug.owner.name )))
57+ '%s (%s)' % (bug.owner.displayname, bug.owner.name)))
58+
59+ # Add the -Bug-Modifier header to identify the person who
60+ # modified the bug report.
61+ if event_creator:
62+ self.common_headers.append(
63+ ('X-Launchpad-Bug-Modifier',
64+ '%s (%s)' % (event_creator.displayname,
65+ event_creator.name)))
66
67 def build(self, from_address, to_address, body, subject, email_date,
68 rationale=None, references=None, message_id=None):