Merge lp:~thomir/launchpad/devel-add-bug-header into lp:launchpad

Proposed by Thomi Richards on 2015-01-09
Status: Merged
Merged at revision: 17309
Proposed branch: lp:~thomir/launchpad/devel-add-bug-header
Merge into: lp:launchpad
Diff against target: 39 lines (+10/-0)
3 files modified
lib/lp/bugs/doc/bugnotification-email.txt (+1/-0)
lib/lp/bugs/mail/bugnotificationbuilder.py (+1/-0)
lib/lp/bugs/mail/tests/test_bugnotificationbuilder.py (+8/-0)
To merge this branch: bzr merge lp:~thomir/launchpad/devel-add-bug-header
Reviewer Review Type Date Requested Status
William Grant code 2015-01-09 Approve on 2015-01-27
Review via email: mp+245921@code.launchpad.net

Commit Message

Add the X-Launchpad-Notification-Type header to bug notification emails.

Description of the Change

Add the X-Launchpad-Notification-Type header to bug notification emails.

To post a comment you must log in.
William Grant (wgrant) :
review: Needs Fixing (code)
William Grant (wgrant) wrote :

This will probably break lots of bugs tests. Could you run bin/test -t bugs and fix any fallout?

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/doc/bugnotification-email.txt'
2--- lib/lp/bugs/doc/bugnotification-email.txt 2015-01-05 07:52:01 +0000
3+++ lib/lp/bugs/doc/bugnotification-email.txt 2015-01-28 00:26:22 +0000
4@@ -523,6 +523,7 @@
5 ... print ': '.join(header)
6 Reply-To: Bug 4 <4@bugs.launchpad.net>
7 Sender: bounces@canonical.com
8+ X-Launchpad-Notification-Type: bug
9 X-Launchpad-Bug: product=firefox; ...; assignee=None;
10 X-Launchpad-Bug-Tags: bar foo
11 X-Launchpad-Bug-Information-Type: Private Security
12
13=== modified file 'lib/lp/bugs/mail/bugnotificationbuilder.py'
14--- lib/lp/bugs/mail/bugnotificationbuilder.py 2012-09-19 01:19:35 +0000
15+++ lib/lp/bugs/mail/bugnotificationbuilder.py 2015-01-28 00:26:22 +0000
16@@ -102,6 +102,7 @@
17 self.common_headers = [
18 ('Reply-To', get_bugmail_replyto_address(bug)),
19 ('Sender', config.canonical.bounce_address),
20+ ('X-Launchpad-Notification-Type', 'bug'),
21 ]
22
23 # X-Launchpad-Bug
24
25=== modified file 'lib/lp/bugs/mail/tests/test_bugnotificationbuilder.py'
26--- lib/lp/bugs/mail/tests/test_bugnotificationbuilder.py 2012-01-01 02:58:52 +0000
27+++ lib/lp/bugs/mail/tests/test_bugnotificationbuilder.py 2015-01-28 00:26:22 +0000
28@@ -50,3 +50,11 @@
29 self.assertContentEqual(
30 [u"Testing filter", u"Second testing filter"],
31 message.get_all("X-Launchpad-Subscription"))
32+
33+ def test_mails_contain_notification_type_header(self):
34+ utc_now = datetime.now(pytz.UTC)
35+ message = self.builder.build(
36+ 'from', 'to', 'body', 'subject', utc_now, filters=[])
37+ self.assertEqual(
38+ "bug", message.get("X-Launchpad-Notification-Type", None))
39+