← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Brian Murray has proposed merging lp:~brian-murray/launchpad/bug-605340 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #605340 No way to get launchpad user id from a bug comment email
  https://bugs.launchpad.net/bugs/605340


= 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
-- 
https://code.launchpad.net/~brian-murray/launchpad/bug-605340/+merge/31221
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~brian-murray/launchpad/bug-605340 into lp:launchpad/devel.
=== 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-28 23:26:18 +0000
@@ -94,7 +94,7 @@
     references = [bug.initial_message.rfc822msgid]
     recipients = bug.getBugNotificationRecipients()
 
-    bug_notification_builder = BugNotificationBuilder(bug)
+    bug_notification_builder = BugNotificationBuilder(bug, event_creator)
     for to_addr in sorted(to_addrs):
         reason, rationale = recipients.getReason(to_addr)
         subject, contents = generate_bug_add_email(

=== 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-28 23:26:18 +0000
@@ -495,7 +495,8 @@
 When instantiatiated it derives a list of common unchanging headers
 from the bug so that they are not calculated for every recipient.
 
-    >>> bug_four_notification_builder = BugNotificationBuilder(bug_four)
+    >>> bug_four_notification_builder = BugNotificationBuilder(bug_four,
+    ...     private_person)
     >>> for header in bug_four_notification_builder.common_headers:
     ...     print ': '.join(header)
     Reply-To: Bug 4 <4@xxxxxxxxxxxxxxxxxx>
@@ -506,6 +507,7 @@
     X-Launchpad-Bug-Security-Vulnerability: yes
     X-Launchpad-Bug-Commenters: name12
     X-Launchpad-Bug-Reporter: Sample Person (name12)
+    X-Launchpad-Bug-Modifier: Ford Prefect (person-name...)
 
 The build() method of a builder accepts a number of parameters and
 returns an instance of email.MIMEText. The most basic invocation of

=== 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-28 23:26:18 +0000
@@ -91,8 +91,9 @@
     up-front.
     """
 
-    def __init__(self, bug):
+    def __init__(self, bug, event_creator=None):
         self.bug = bug
+        self.event_creator = event_creator
 
         # Pre-calculate common headers.
         self.common_headers = [
@@ -140,7 +141,15 @@
         # and the original bug task for filtering
         self.common_headers.append(
             ('X-Launchpad-Bug-Reporter',
-             '%s (%s)' % ( bug.owner.displayname, bug.owner.name )))
+             '%s (%s)' % (bug.owner.displayname, bug.owner.name)))
+
+        # Add the -Bug-Modifier header to identify the person who
+        # modified the bug report
+        if event_creator:
+            self.common_headers.append(
+                ('X-Launchpad-Bug-Modifier',
+                    '%s (%s)' % (event_creator.displayname,
+                        event_creator.name)))
 
     def build(self, from_address, to_address, body, subject, email_date,
               rationale=None, references=None, message_id=None):