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
=== modified file 'lib/canonical/launchpad/mailnotification.py'
--- lib/canonical/launchpad/mailnotification.py 2010-06-24 10:12:01 +0000
+++ lib/canonical/launchpad/mailnotification.py 2010-07-29 16:47:49 +0000
@@ -94,7 +94,7 @@
94 references = [bug.initial_message.rfc822msgid]94 references = [bug.initial_message.rfc822msgid]
95 recipients = bug.getBugNotificationRecipients()95 recipients = bug.getBugNotificationRecipients()
9696
97 bug_notification_builder = BugNotificationBuilder(bug)97 bug_notification_builder = BugNotificationBuilder(bug, event_creator)
98 for to_addr in sorted(to_addrs):98 for to_addr in sorted(to_addrs):
99 reason, rationale = recipients.getReason(to_addr)99 reason, rationale = recipients.getReason(to_addr)
100 subject, contents = generate_bug_add_email(100 subject, contents = generate_bug_add_email(
101101
=== modified file 'lib/lp/bugs/doc/bugnotification-email.txt'
--- lib/lp/bugs/doc/bugnotification-email.txt 2010-06-24 10:12:01 +0000
+++ lib/lp/bugs/doc/bugnotification-email.txt 2010-07-29 16:47:49 +0000
@@ -495,7 +495,8 @@
495When instantiatiated it derives a list of common unchanging headers495When instantiatiated it derives a list of common unchanging headers
496from the bug so that they are not calculated for every recipient.496from the bug so that they are not calculated for every recipient.
497497
498 >>> bug_four_notification_builder = BugNotificationBuilder(bug_four)498 >>> bug_four_notification_builder = BugNotificationBuilder(bug_four,
499 ... private_person)
499 >>> for header in bug_four_notification_builder.common_headers:500 >>> for header in bug_four_notification_builder.common_headers:
500 ... print ': '.join(header)501 ... print ': '.join(header)
501 Reply-To: Bug 4 <4@bugs.launchpad.net>502 Reply-To: Bug 4 <4@bugs.launchpad.net>
@@ -506,6 +507,7 @@
506 X-Launchpad-Bug-Security-Vulnerability: yes507 X-Launchpad-Bug-Security-Vulnerability: yes
507 X-Launchpad-Bug-Commenters: name12508 X-Launchpad-Bug-Commenters: name12
508 X-Launchpad-Bug-Reporter: Sample Person (name12)509 X-Launchpad-Bug-Reporter: Sample Person (name12)
510 X-Launchpad-Bug-Modifier: Ford Prefect (person-name...)
509511
510The build() method of a builder accepts a number of parameters and512The build() method of a builder accepts a number of parameters and
511returns an instance of email.MIMEText. The most basic invocation of513returns an instance of email.MIMEText. The most basic invocation of
512514
=== modified file 'lib/lp/bugs/mail/bugnotificationbuilder.py'
--- lib/lp/bugs/mail/bugnotificationbuilder.py 2010-06-24 10:12:01 +0000
+++ lib/lp/bugs/mail/bugnotificationbuilder.py 2010-07-29 16:47:49 +0000
@@ -91,7 +91,7 @@
91 up-front.91 up-front.
92 """92 """
9393
94 def __init__(self, bug):94 def __init__(self, bug, event_creator=None):
95 self.bug = bug95 self.bug = bug
9696
97 # Pre-calculate common headers.97 # Pre-calculate common headers.
@@ -137,10 +137,18 @@
137 ('X-Launchpad-Bug-Commenters', ' '.join(sorted(commenters))))137 ('X-Launchpad-Bug-Commenters', ' '.join(sorted(commenters))))
138138
139 # Add the -Bug-Reporter header to identify the owner of the bug139 # Add the -Bug-Reporter header to identify the owner of the bug
140 # and the original bug task for filtering140 # and the original bug task for filtering.
141 self.common_headers.append(141 self.common_headers.append(
142 ('X-Launchpad-Bug-Reporter',142 ('X-Launchpad-Bug-Reporter',
143 '%s (%s)' % ( bug.owner.displayname, bug.owner.name )))143 '%s (%s)' % (bug.owner.displayname, bug.owner.name)))
144
145 # Add the -Bug-Modifier header to identify the person who
146 # modified the bug report.
147 if event_creator:
148 self.common_headers.append(
149 ('X-Launchpad-Bug-Modifier',
150 '%s (%s)' % (event_creator.displayname,
151 event_creator.name)))
144152
145 def build(self, from_address, to_address, body, subject, email_date,153 def build(self, from_address, to_address, body, subject, email_date,
146 rationale=None, references=None, message_id=None):154 rationale=None, references=None, message_id=None):