Merge lp:~cjwatson/launchpad/message-for-header into lp:launchpad
- message-for-header
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 17730 |
Proposed branch: | lp:~cjwatson/launchpad/message-for-header |
Merge into: | lp:launchpad |
Diff against target: |
895 lines (+141/-40) 28 files modified
lib/lp/answers/model/questionjob.py (+1/-0) lib/lp/bugs/doc/bugnotification-email.txt (+6/-0) lib/lp/bugs/doc/bugnotification-sending.txt (+30/-4) lib/lp/bugs/doc/initial-bug-contacts.txt (+2/-0) lib/lp/bugs/mail/bugnotificationbuilder.py (+11/-0) lib/lp/bugs/stories/bugs/bug-add-subscriber.txt (+1/-0) lib/lp/code/doc/branch-merge-proposal-notifications.txt (+12/-7) lib/lp/code/doc/branch-notifications.txt (+2/-0) lib/lp/code/doc/codeimport.txt (+2/-0) lib/lp/code/mail/codeimport.py (+5/-1) lib/lp/code/mail/tests/test_branch.py (+2/-0) lib/lp/code/mail/tests/test_branchmergeproposal.py (+1/-0) lib/lp/code/mail/tests/test_codereviewcomment.py (+2/-0) lib/lp/code/mail/tests/test_sourcepackagerecipebuild.py (+4/-0) lib/lp/registry/browser/person.py (+1/-1) lib/lp/registry/doc/teammembership-email-notification.txt (+2/-1) lib/lp/registry/mail/notification.py (+7/-4) lib/lp/registry/model/productjob.py (+2/-1) lib/lp/registry/tests/test_notification.py (+10/-6) lib/lp/registry/tests/test_productjob.py (+3/-1) lib/lp/services/mail/basemailer.py (+2/-0) lib/lp/services/mail/notificationrecipientset.py (+1/-0) lib/lp/services/mail/tests/test_basemailer.py (+3/-1) lib/lp/snappy/tests/test_snapbuild.py (+1/-0) lib/lp/soyuz/mail/tests/test_packageupload.py (+14/-7) lib/lp/soyuz/tests/test_build_notify.py (+3/-0) lib/lp/soyuz/tests/test_livefsbuild.py (+2/-1) lib/lp/testing/mail_helpers.py (+9/-5) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/message-for-header |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+270811@code.launchpad.net |
Commit message
Add an X-Launchpad-
Description of the change
Add an X-Launchpad-
There are several times more implementations of this than there ought to be, because not everything goes through BaseMailer yet; and the implementation for bug notifications is horrible because BugNotification
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) : | # |
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/answers/model/questionjob.py' | |||
2 | --- lib/lp/answers/model/questionjob.py 2015-08-25 16:24:06 +0000 | |||
3 | +++ lib/lp/answers/model/questionjob.py 2015-09-11 12:44:20 +0000 | |||
4 | @@ -236,6 +236,7 @@ | |||
5 | 236 | for email in recipients.getEmails(): | 236 | for email in recipients.getEmails(): |
6 | 237 | reason, header = recipients.getReason(email) | 237 | reason, header = recipients.getReason(email) |
7 | 238 | headers['X-Launchpad-Message-Rationale'] = header | 238 | headers['X-Launchpad-Message-Rationale'] = header |
8 | 239 | headers['X-Launchpad-Message-For'] = reason.subscriber.name | ||
9 | 239 | formatted_body = self.buildBody(reason.getReason()) | 240 | formatted_body = self.buildBody(reason.getReason()) |
10 | 240 | simple_sendmail( | 241 | simple_sendmail( |
11 | 241 | self.from_address, email, self.subject, formatted_body, | 242 | self.from_address, email, self.subject, formatted_body, |
12 | 242 | 243 | ||
13 | === modified file 'lib/lp/bugs/doc/bugnotification-email.txt' | |||
14 | --- lib/lp/bugs/doc/bugnotification-email.txt 2015-07-31 14:46:31 +0000 | |||
15 | +++ lib/lp/bugs/doc/bugnotification-email.txt 2015-09-11 12:44:20 +0000 | |||
16 | @@ -585,6 +585,12 @@ | |||
17 | 585 | >>> print notification_email['X-Launchpad-Message-Rationale'] | 585 | >>> print notification_email['X-Launchpad-Message-Rationale'] |
18 | 586 | Because-I-said-so | 586 | Because-I-said-so |
19 | 587 | 587 | ||
20 | 588 | The X-Launchpad-Message-For header is set from the to_person (since this | ||
21 | 589 | notification is not for a team). | ||
22 | 590 | |||
23 | 591 | >>> print notification_email['X-Launchpad-Message-For'] | ||
24 | 592 | name16 | ||
25 | 593 | |||
26 | 588 | The references parameter sets the References header of the email. | 594 | The references parameter sets the References header of the email. |
27 | 589 | 595 | ||
28 | 590 | >>> print notification_email['References'] | 596 | >>> print notification_email['References'] |
29 | 591 | 597 | ||
30 | === modified file 'lib/lp/bugs/doc/bugnotification-sending.txt' | |||
31 | --- lib/lp/bugs/doc/bugnotification-sending.txt 2015-07-13 16:14:46 +0000 | |||
32 | +++ lib/lp/bugs/doc/bugnotification-sending.txt 2015-09-11 12:44:20 +0000 | |||
33 | @@ -22,6 +22,7 @@ | |||
34 | 22 | >>> def print_notification_headers(email_notification, extra_headers=[]): | 22 | >>> def print_notification_headers(email_notification, extra_headers=[]): |
35 | 23 | ... for header in ['To', 'From', 'Subject', | 23 | ... for header in ['To', 'From', 'Subject', |
36 | 24 | ... 'X-Launchpad-Message-Rationale', | 24 | ... 'X-Launchpad-Message-Rationale', |
37 | 25 | ... 'X-Launchpad-Message-For', | ||
38 | 25 | ... 'X-Launchpad-Subscription'] + extra_headers: | 26 | ... 'X-Launchpad-Subscription'] + extra_headers: |
39 | 26 | ... if email_notification[header]: | 27 | ... if email_notification[header]: |
40 | 27 | ... print "%s: %s" % (header, email_notification[header]) | 28 | ... print "%s: %s" % (header, email_notification[header]) |
41 | @@ -73,6 +74,7 @@ | |||
42 | 73 | From: Sample Person <1@bugs.launchpad.net> | 74 | From: Sample Person <1@bugs.launchpad.net> |
43 | 74 | Subject: [Bug 1] subject | 75 | Subject: [Bug 1] subject |
44 | 75 | X-Launchpad-Message-Rationale: Subscriber (mozilla-firefox in Ubuntu) | 76 | X-Launchpad-Message-Rationale: Subscriber (mozilla-firefox in Ubuntu) |
45 | 77 | X-Launchpad-Message-For: name16 | ||
46 | 76 | <BLANKLINE> | 78 | <BLANKLINE> |
47 | 77 | a comment. | 79 | a comment. |
48 | 78 | <BLANKLINE> | 80 | <BLANKLINE> |
49 | @@ -82,6 +84,7 @@ | |||
50 | 82 | From: Sample Person <1@bugs.launchpad.net> | 84 | From: Sample Person <1@bugs.launchpad.net> |
51 | 83 | Subject: [Bug 1] subject | 85 | Subject: [Bug 1] subject |
52 | 84 | X-Launchpad-Message-Rationale: Assignee | 86 | X-Launchpad-Message-Rationale: Assignee |
53 | 87 | X-Launchpad-Message-For: mark | ||
54 | 85 | <BLANKLINE> | 88 | <BLANKLINE> |
55 | 86 | a comment. | 89 | a comment. |
56 | 87 | <BLANKLINE> | 90 | <BLANKLINE> |
57 | @@ -91,6 +94,7 @@ | |||
58 | 91 | From: Sample Person <1@bugs.launchpad.net> | 94 | From: Sample Person <1@bugs.launchpad.net> |
59 | 92 | Subject: [Bug 1] subject | 95 | Subject: [Bug 1] subject |
60 | 93 | X-Launchpad-Message-Rationale: Subscriber | 96 | X-Launchpad-Message-Rationale: Subscriber |
61 | 97 | X-Launchpad-Message-For: name12 | ||
62 | 94 | <BLANKLINE> | 98 | <BLANKLINE> |
63 | 95 | a comment. | 99 | a comment. |
64 | 96 | <BLANKLINE> | 100 | <BLANKLINE> |
65 | @@ -154,6 +158,7 @@ | |||
66 | 154 | From: Sample Person <1@bugs.launchpad.net> | 158 | From: Sample Person <1@bugs.launchpad.net> |
67 | 155 | Subject: Re: [Bug 1] subject | 159 | Subject: Re: [Bug 1] subject |
68 | 156 | X-Launchpad-Message-Rationale: Assignee | 160 | X-Launchpad-Message-Rationale: Assignee |
69 | 161 | X-Launchpad-Message-For: mark | ||
70 | 157 | <BLANKLINE> | 162 | <BLANKLINE> |
71 | 158 | a new comment. | 163 | a new comment. |
72 | 159 | <BLANKLINE> | 164 | <BLANKLINE> |
73 | @@ -193,6 +198,7 @@ | |||
74 | 193 | From: Sample Person <1@bugs.launchpad.net> | 198 | From: Sample Person <1@bugs.launchpad.net> |
75 | 194 | Subject: [Bug 1] Re: Firefox does not support SVG | 199 | Subject: [Bug 1] Re: Firefox does not support SVG |
76 | 195 | X-Launchpad-Message-Rationale: Assignee | 200 | X-Launchpad-Message-Rationale: Assignee |
77 | 201 | X-Launchpad-Message-For: mark | ||
78 | 196 | <BLANKLINE> | 202 | <BLANKLINE> |
79 | 197 | ** Summary changed: | 203 | ** Summary changed: |
80 | 198 | - Old summary | 204 | - Old summary |
81 | @@ -239,6 +245,7 @@ | |||
82 | 239 | From: Sample Person <1@bugs.launchpad.net> | 245 | From: Sample Person <1@bugs.launchpad.net> |
83 | 240 | Subject: [Bug 1] Re: Firefox does not support SVG | 246 | Subject: [Bug 1] Re: Firefox does not support SVG |
84 | 241 | X-Launchpad-Message-Rationale: Assignee | 247 | X-Launchpad-Message-Rationale: Assignee |
85 | 248 | X-Launchpad-Message-For: mark | ||
86 | 242 | <BLANKLINE> | 249 | <BLANKLINE> |
87 | 243 | a new comment. | 250 | a new comment. |
88 | 244 | <BLANKLINE> | 251 | <BLANKLINE> |
89 | @@ -366,6 +373,7 @@ | |||
90 | 366 | From: Sample Person <16@bugs.launchpad.net> | 373 | From: Sample Person <16@bugs.launchpad.net> |
91 | 367 | Subject: [Bug 16] [NEW] new bug | 374 | Subject: [Bug 16] [NEW] new bug |
92 | 368 | X-Launchpad-Message-Rationale: Subscriber | 375 | X-Launchpad-Message-Rationale: Subscriber |
93 | 376 | X-Launchpad-Message-For: name12 | ||
94 | 369 | <BLANKLINE> | 377 | <BLANKLINE> |
95 | 370 | Public bug reported: | 378 | Public bug reported: |
96 | 371 | ... | 379 | ... |
97 | @@ -396,6 +404,7 @@ | |||
98 | 396 | From: Sample Person <16@bugs.launchpad.net> | 404 | From: Sample Person <16@bugs.launchpad.net> |
99 | 397 | Subject: [Bug 16] subject | 405 | Subject: [Bug 16] subject |
100 | 398 | X-Launchpad-Message-Rationale: Subscriber | 406 | X-Launchpad-Message-Rationale: Subscriber |
101 | 407 | X-Launchpad-Message-For: name12 | ||
102 | 399 | X-Launchpad-Bug-Duplicate: 1 | 408 | X-Launchpad-Bug-Duplicate: 1 |
103 | 400 | <BLANKLINE> | 409 | <BLANKLINE> |
104 | 401 | *** This bug is a duplicate of bug 1 *** | 410 | *** This bug is a duplicate of bug 1 *** |
105 | @@ -432,6 +441,7 @@ | |||
106 | 432 | From: Sample Person <...@bugs.launchpad.net> | 441 | From: Sample Person <...@bugs.launchpad.net> |
107 | 433 | Subject: [Bug ...] [NEW] Zero-day on Frobulator | 442 | Subject: [Bug ...] [NEW] Zero-day on Frobulator |
108 | 434 | X-Launchpad-Message-Rationale: Subscriber | 443 | X-Launchpad-Message-Rationale: Subscriber |
109 | 444 | X-Launchpad-Message-For: name12 | ||
110 | 435 | <BLANKLINE> | 445 | <BLANKLINE> |
111 | 436 | *** This bug is a security vulnerability *** | 446 | *** This bug is a security vulnerability *** |
112 | 437 | <BLANKLINE> | 447 | <BLANKLINE> |
113 | @@ -456,6 +466,7 @@ | |||
114 | 456 | From: Sample Person <...@bugs.launchpad.net> | 466 | From: Sample Person <...@bugs.launchpad.net> |
115 | 457 | Subject: [Bug ...] subject | 467 | Subject: [Bug ...] subject |
116 | 458 | X-Launchpad-Message-Rationale: Subscriber | 468 | X-Launchpad-Message-Rationale: Subscriber |
117 | 469 | X-Launchpad-Message-For: name12 | ||
118 | 459 | <BLANKLINE> | 470 | <BLANKLINE> |
119 | 460 | a comment. | 471 | a comment. |
120 | 461 | <BLANKLINE> | 472 | <BLANKLINE> |
121 | @@ -538,6 +549,7 @@ | |||
122 | 538 | References: foo@example.com-332342--1231 | 549 | References: foo@example.com-332342--1231 |
123 | 539 | ... | 550 | ... |
124 | 540 | X-Launchpad-Message-Rationale: Assignee | 551 | X-Launchpad-Message-Rationale: Assignee |
125 | 552 | X-Launchpad-Message-For: name12 | ||
126 | 541 | ... | 553 | ... |
127 | 542 | INFO Notifying foo.bar@canonical.com about bug 1. | 554 | INFO Notifying foo.bar@canonical.com about bug 1. |
128 | 543 | ... | 555 | ... |
129 | @@ -548,6 +560,7 @@ | |||
130 | 548 | References: sdsdfsfd | 560 | References: sdsdfsfd |
131 | 549 | ... | 561 | ... |
132 | 550 | X-Launchpad-Message-Rationale: Subscriber (mozilla-firefox in Ubuntu) | 562 | X-Launchpad-Message-Rationale: Subscriber (mozilla-firefox in Ubuntu) |
133 | 563 | X-Launchpad-Message-For: name16 | ||
134 | 551 | ... | 564 | ... |
135 | 552 | INFO Notifying mark@example.com about bug 1. | 565 | INFO Notifying mark@example.com about bug 1. |
136 | 553 | ... | 566 | ... |
137 | @@ -564,6 +577,7 @@ | |||
138 | 564 | References: sdsdfsfd | 577 | References: sdsdfsfd |
139 | 565 | ... | 578 | ... |
140 | 566 | X-Launchpad-Message-Rationale: Subscriber (mozilla-firefox in Ubuntu) | 579 | X-Launchpad-Message-Rationale: Subscriber (mozilla-firefox in Ubuntu) |
141 | 580 | X-Launchpad-Message-For: name16 | ||
142 | 567 | Errors-To: bounces@canonical.com | 581 | Errors-To: bounces@canonical.com |
143 | 568 | Return-Path: bounces@canonical.com | 582 | Return-Path: bounces@canonical.com |
144 | 569 | Precedence: bulk | 583 | Precedence: bulk |
145 | @@ -840,12 +854,14 @@ | |||
146 | 840 | ... "will be automatically wrapped by the BugNotification " | 854 | ... "will be automatically wrapped by the BugNotification " |
147 | 841 | ... "machinery. Ain't technology great?") | 855 | ... "machinery. Ain't technology great?") |
148 | 842 | ... verbose_person = factory.makePerson( | 856 | ... verbose_person = factory.makePerson( |
150 | 843 | ... displayname='Verbose Person', email='verbose@example.com', | 857 | ... name='verbose-person', displayname='Verbose Person', |
151 | 858 | ... email='verbose@example.com', | ||
152 | 844 | ... selfgenerated_bugnotifications=True) | 859 | ... selfgenerated_bugnotifications=True) |
153 | 845 | ... verbose_person.verbose_bugnotifications = True | 860 | ... verbose_person.verbose_bugnotifications = True |
154 | 846 | ... ignored = bug.subscribe(verbose_person, verbose_person) | 861 | ... ignored = bug.subscribe(verbose_person, verbose_person) |
155 | 847 | ... concise_person = factory.makePerson( | 862 | ... concise_person = factory.makePerson( |
157 | 848 | ... displayname='Concise Person', email='concise@example.com') | 863 | ... name='concise-person', displayname='Concise Person', |
158 | 864 | ... email='concise@example.com') | ||
159 | 849 | ... concise_person.verbose_bugnotifications = False | 865 | ... concise_person.verbose_bugnotifications = False |
160 | 850 | ... ignored = bug.subscribe(concise_person, concise_person) | 866 | ... ignored = bug.subscribe(concise_person, concise_person) |
161 | 851 | 867 | ||
162 | @@ -858,7 +874,7 @@ | |||
163 | 858 | ... name='conciseteam', displayname='Concise Team') | 874 | ... name='conciseteam', displayname='Concise Team') |
164 | 859 | ... concise_team.verbose_bugnotifications = False | 875 | ... concise_team.verbose_bugnotifications = False |
165 | 860 | ... concise_team_person = factory.makePerson( | 876 | ... concise_team_person = factory.makePerson( |
167 | 861 | ... displayname='Concise Team Person', | 877 | ... name='conciseteam-person', displayname='Concise Team Person', |
168 | 862 | ... email='conciseteam@example.com') | 878 | ... email='conciseteam@example.com') |
169 | 863 | ... concise_team_person.verbose_bugnotifications = True | 879 | ... concise_team_person.verbose_bugnotifications = True |
170 | 864 | ... ignored = concise_team.addMember( | 880 | ... ignored = concise_team.addMember( |
171 | @@ -873,7 +889,7 @@ | |||
172 | 873 | ... name='verboseteam', displayname='Verbose Team') | 889 | ... name='verboseteam', displayname='Verbose Team') |
173 | 874 | ... verbose_team.verbose_bugnotifications = True | 890 | ... verbose_team.verbose_bugnotifications = True |
174 | 875 | ... verbose_team_person = factory.makePerson( | 891 | ... verbose_team_person = factory.makePerson( |
176 | 876 | ... displayname='Verbose Team Person', | 892 | ... name='verboseteam-person', displayname='Verbose Team Person', |
177 | 877 | ... email='verboseteam@example.com') | 893 | ... email='verboseteam@example.com') |
178 | 878 | ... verbose_team_person.verbose_bugnotifications = False | 894 | ... verbose_team_person.verbose_bugnotifications = False |
179 | 879 | ... ignored = verbose_team.addMember( | 895 | ... ignored = verbose_team.addMember( |
180 | @@ -934,6 +950,7 @@ | |||
181 | 934 | From: Verbose Person <verbose@example.com> | 950 | From: Verbose Person <verbose@example.com> |
182 | 935 | Subject: [Bug ...] subject | 951 | Subject: [Bug ...] subject |
183 | 936 | X-Launchpad-Message-Rationale: Subscriber | 952 | X-Launchpad-Message-Rationale: Subscriber |
184 | 953 | X-Launchpad-Message-For: concise-person | ||
185 | 937 | <BLANKLINE> | 954 | <BLANKLINE> |
186 | 938 | a really simple comment. | 955 | a really simple comment. |
187 | 939 | <BLANKLINE> | 956 | <BLANKLINE> |
188 | @@ -961,6 +978,7 @@ | |||
189 | 961 | From: Verbose Person <verbose@example.com> | 978 | From: Verbose Person <verbose@example.com> |
190 | 962 | Subject: [Bug ...] subject | 979 | Subject: [Bug ...] subject |
191 | 963 | X-Launchpad-Message-Rationale: Subscriber @verboseteam | 980 | X-Launchpad-Message-Rationale: Subscriber @verboseteam |
192 | 981 | X-Launchpad-Message-For: verboseteam | ||
193 | 964 | <BLANKLINE> | 982 | <BLANKLINE> |
194 | 965 | a really simple comment. | 983 | a really simple comment. |
195 | 966 | <BLANKLINE> | 984 | <BLANKLINE> |
196 | @@ -980,6 +998,7 @@ | |||
197 | 980 | From: Verbose Person <verbose@example.com> | 998 | From: Verbose Person <verbose@example.com> |
198 | 981 | Subject: [Bug ...] subject | 999 | Subject: [Bug ...] subject |
199 | 982 | X-Launchpad-Message-Rationale: Subscriber | 1000 | X-Launchpad-Message-Rationale: Subscriber |
200 | 1001 | X-Launchpad-Message-For: verbose-person | ||
201 | 983 | <BLANKLINE> | 1002 | <BLANKLINE> |
202 | 984 | a really simple comment. | 1003 | a really simple comment. |
203 | 985 | <BLANKLINE> | 1004 | <BLANKLINE> |
204 | @@ -1010,6 +1029,7 @@ | |||
205 | 1010 | From: Verbose Person <verbose@example.com> | 1029 | From: Verbose Person <verbose@example.com> |
206 | 1011 | Subject: [Bug ...] subject | 1030 | Subject: [Bug ...] subject |
207 | 1012 | X-Launchpad-Message-Rationale: Subscriber @conciseteam | 1031 | X-Launchpad-Message-Rationale: Subscriber @conciseteam |
208 | 1032 | X-Launchpad-Message-For: conciseteam | ||
209 | 1013 | <BLANKLINE> | 1033 | <BLANKLINE> |
210 | 1014 | a really simple comment. | 1034 | a really simple comment. |
211 | 1015 | <BLANKLINE> | 1035 | <BLANKLINE> |
212 | @@ -1134,6 +1154,7 @@ | |||
213 | 1134 | From: Sample Person <...@bugs.launchpad.net> | 1154 | From: Sample Person <...@bugs.launchpad.net> |
214 | 1135 | Subject: [Bug 1] subject | 1155 | Subject: [Bug 1] subject |
215 | 1136 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) | 1156 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) |
216 | 1157 | X-Launchpad-Message-For: no-priv | ||
217 | 1137 | <BLANKLINE> | 1158 | <BLANKLINE> |
218 | 1138 | another comment. | 1159 | another comment. |
219 | 1139 | <BLANKLINE> | 1160 | <BLANKLINE> |
220 | @@ -1190,6 +1211,7 @@ | |||
221 | 1190 | From: Sample Person <...@bugs.launchpad.net> | 1211 | From: Sample Person <...@bugs.launchpad.net> |
222 | 1191 | Subject: [Bug 1] subject | 1212 | Subject: [Bug 1] subject |
223 | 1192 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) | 1213 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) |
224 | 1214 | X-Launchpad-Message-For: no-priv | ||
225 | 1193 | X-Launchpad-Subscription: Allow-comments filter | 1215 | X-Launchpad-Subscription: Allow-comments filter |
226 | 1194 | <BLANKLINE> | 1216 | <BLANKLINE> |
227 | 1195 | another comment. | 1217 | another comment. |
228 | @@ -1245,6 +1267,7 @@ | |||
229 | 1245 | From: Sample Person <...@bugs.launchpad.net> | 1267 | From: Sample Person <...@bugs.launchpad.net> |
230 | 1246 | Subject: [Bug 1] subject | 1268 | Subject: [Bug 1] subject |
231 | 1247 | X-Launchpad-Message-Rationale: Subscriber @addressless | 1269 | X-Launchpad-Message-Rationale: Subscriber @addressless |
232 | 1270 | X-Launchpad-Message-For: addressless | ||
233 | 1248 | <BLANKLINE> | 1271 | <BLANKLINE> |
234 | 1249 | no comment for no-priv. | 1272 | no comment for no-priv. |
235 | 1250 | <BLANKLINE> | 1273 | <BLANKLINE> |
236 | @@ -1291,6 +1314,7 @@ | |||
237 | 1291 | From: Sample Person <...@bugs.launchpad.net> | 1314 | From: Sample Person <...@bugs.launchpad.net> |
238 | 1292 | Subject: [Bug 1] subject | 1315 | Subject: [Bug 1] subject |
239 | 1293 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) | 1316 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) |
240 | 1317 | X-Launchpad-Message-For: no-priv | ||
241 | 1294 | X-Launchpad-Subscription: Allow-comments filter | 1318 | X-Launchpad-Subscription: Allow-comments filter |
242 | 1295 | <BLANKLINE> | 1319 | <BLANKLINE> |
243 | 1296 | no comment for no-priv. | 1320 | no comment for no-priv. |
244 | @@ -1350,6 +1374,7 @@ | |||
245 | 1350 | From: Sample Person <...@bugs.launchpad.net> | 1374 | From: Sample Person <...@bugs.launchpad.net> |
246 | 1351 | Subject: [Bug 1] Re: Firefox does not support SVG | 1375 | Subject: [Bug 1] Re: Firefox does not support SVG |
247 | 1352 | X-Launchpad-Message-Rationale: Subscriber @addressless | 1376 | X-Launchpad-Message-Rationale: Subscriber @addressless |
248 | 1377 | X-Launchpad-Message-For: addressless | ||
249 | 1353 | <BLANKLINE> | 1378 | <BLANKLINE> |
250 | 1354 | ** Summary changed: | 1379 | ** Summary changed: |
251 | 1355 | - Whatever | 1380 | - Whatever |
252 | @@ -1405,6 +1430,7 @@ | |||
253 | 1405 | From: Sample Person <...@bugs.launchpad.net> | 1430 | From: Sample Person <...@bugs.launchpad.net> |
254 | 1406 | Subject: [Bug 1] Re: Firefox does not support SVG | 1431 | Subject: [Bug 1] Re: Firefox does not support SVG |
255 | 1407 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) | 1432 | X-Launchpad-Message-Rationale: Subscriber (Mozilla Firefox) |
256 | 1433 | X-Launchpad-Message-For: no-priv | ||
257 | 1408 | <BLANKLINE> | 1434 | <BLANKLINE> |
258 | 1409 | ** Summary changed: | 1435 | ** Summary changed: |
259 | 1410 | - I'm losing my | 1436 | - I'm losing my |
260 | 1411 | 1437 | ||
261 | === modified file 'lib/lp/bugs/doc/initial-bug-contacts.txt' | |||
262 | --- lib/lp/bugs/doc/initial-bug-contacts.txt 2012-08-16 07:02:41 +0000 | |||
263 | +++ lib/lp/bugs/doc/initial-bug-contacts.txt 2015-09-11 12:44:20 +0000 | |||
264 | @@ -191,6 +191,8 @@ | |||
265 | 191 | 191 | ||
266 | 192 | >>> msg['X-Launchpad-Message-Rationale'] | 192 | >>> msg['X-Launchpad-Message-Rationale'] |
267 | 193 | 'Subscriber (pmount in Ubuntu)' | 193 | 'Subscriber (pmount in Ubuntu)' |
268 | 194 | >>> msg['X-Launchpad-Message-For'] | ||
269 | 195 | 'daf' | ||
270 | 194 | 196 | ||
271 | 195 | >>> msg['Subject'] | 197 | >>> msg['Subject'] |
272 | 196 | '[Bug 1] [NEW] Firefox does not support SVG' | 198 | '[Bug 1] [NEW] Firefox does not support SVG' |
273 | 197 | 199 | ||
274 | === modified file 'lib/lp/bugs/mail/bugnotificationbuilder.py' | |||
275 | --- lib/lp/bugs/mail/bugnotificationbuilder.py 2015-08-28 06:44:52 +0000 | |||
276 | +++ lib/lp/bugs/mail/bugnotificationbuilder.py 2015-09-11 12:44:20 +0000 | |||
277 | @@ -13,6 +13,7 @@ | |||
278 | 13 | 13 | ||
279 | 14 | from email.mime.text import MIMEText | 14 | from email.mime.text import MIMEText |
280 | 15 | from email.utils import formatdate | 15 | from email.utils import formatdate |
281 | 16 | import re | ||
282 | 16 | import rfc822 | 17 | import rfc822 |
283 | 17 | 18 | ||
284 | 18 | from zope.component import getUtility | 19 | from zope.component import getUtility |
285 | @@ -207,6 +208,16 @@ | |||
286 | 207 | 208 | ||
287 | 208 | if rationale is not None: | 209 | if rationale is not None: |
288 | 209 | headers.append(('X-Launchpad-Message-Rationale', rationale)) | 210 | headers.append(('X-Launchpad-Message-Rationale', rationale)) |
289 | 211 | # XXX cjwatson 2015-09-11: The ridiculously complicated way that | ||
290 | 212 | # bug notifications are built means that we no longer have | ||
291 | 213 | # direct access to the subscriber name at this point. As a | ||
292 | 214 | # stopgap, parse it out of the rationale. | ||
293 | 215 | match = re.search(r'@([^ ]*)', rationale) | ||
294 | 216 | if match is not None: | ||
295 | 217 | message_for = match.group(1) | ||
296 | 218 | else: | ||
297 | 219 | message_for = removeSecurityProxy(to_person).name | ||
298 | 220 | headers.append(('X-Launchpad-Message-For', message_for)) | ||
299 | 210 | 221 | ||
300 | 211 | if filters is not None: | 222 | if filters is not None: |
301 | 212 | for filter in filters: | 223 | for filter in filters: |
302 | 213 | 224 | ||
303 | === modified file 'lib/lp/bugs/stories/bugs/bug-add-subscriber.txt' | |||
304 | --- lib/lp/bugs/stories/bugs/bug-add-subscriber.txt 2012-07-27 01:15:04 +0000 | |||
305 | +++ lib/lp/bugs/stories/bugs/bug-add-subscriber.txt 2015-09-11 12:44:20 +0000 | |||
306 | @@ -82,6 +82,7 @@ | |||
307 | 82 | Reply-To: Bug ... <...@bugs.launchpad.net> | 82 | Reply-To: Bug ... <...@bugs.launchpad.net> |
308 | 83 | ... | 83 | ... |
309 | 84 | X-Launchpad-Message-Rationale: Subscriber | 84 | X-Launchpad-Message-Rationale: Subscriber |
310 | 85 | X-Launchpad-Message-For: ddaa | ||
311 | 85 | ... | 86 | ... |
312 | 86 | You have been subscribed to a public bug by No Privileges Person (no-priv): | 87 | You have been subscribed to a public bug by No Privileges Person (no-priv): |
313 | 87 | ... | 88 | ... |
314 | 88 | 89 | ||
315 | === modified file 'lib/lp/code/doc/branch-merge-proposal-notifications.txt' | |||
316 | --- lib/lp/code/doc/branch-merge-proposal-notifications.txt 2015-09-02 16:54:24 +0000 | |||
317 | +++ lib/lp/code/doc/branch-merge-proposal-notifications.txt 2015-09-11 12:44:20 +0000 | |||
318 | @@ -29,13 +29,15 @@ | |||
319 | 29 | >>> previewdiff = factory.makePreviewDiff(merge_proposal=bmp) | 29 | >>> previewdiff = factory.makePreviewDiff(merge_proposal=bmp) |
320 | 30 | >>> transaction.commit() | 30 | >>> transaction.commit() |
321 | 31 | >>> source_subscriber = factory.makePerson( | 31 | >>> source_subscriber = factory.makePerson( |
323 | 32 | ... email='source@example.com', displayname='Source Subscriber') | 32 | ... email='source@example.com', name='source-subscriber', |
324 | 33 | ... displayname='Source Subscriber') | ||
325 | 33 | >>> _unused = bmp.source_branch.subscribe(source_subscriber, | 34 | >>> _unused = bmp.source_branch.subscribe(source_subscriber, |
326 | 34 | ... BranchSubscriptionNotificationLevel.NOEMAIL, | 35 | ... BranchSubscriptionNotificationLevel.NOEMAIL, |
327 | 35 | ... BranchSubscriptionDiffSize.NODIFF, | 36 | ... BranchSubscriptionDiffSize.NODIFF, |
328 | 36 | ... CodeReviewNotificationLevel.STATUS, source_subscriber) | 37 | ... CodeReviewNotificationLevel.STATUS, source_subscriber) |
329 | 37 | >>> target_subscriber = factory.makePerson( | 38 | >>> target_subscriber = factory.makePerson( |
331 | 38 | ... email='target@example.com', displayname='Target Subscriber') | 39 | ... email='target@example.com', name='target-subscriber', |
332 | 40 | ... displayname='Target Subscriber') | ||
333 | 39 | >>> target_subscription = bmp.target_branch.subscribe(target_subscriber, | 41 | >>> target_subscription = bmp.target_branch.subscribe(target_subscriber, |
334 | 40 | ... BranchSubscriptionNotificationLevel.NOEMAIL, | 42 | ... BranchSubscriptionNotificationLevel.NOEMAIL, |
335 | 41 | ... BranchSubscriptionDiffSize.NODIFF, | 43 | ... BranchSubscriptionDiffSize.NODIFF, |
336 | @@ -136,6 +138,8 @@ | |||
337 | 136 | ~person-name... | 138 | ~person-name... |
338 | 137 | >>> print notification['X-Launchpad-Message-Rationale'] | 139 | >>> print notification['X-Launchpad-Message-Rationale'] |
339 | 138 | Subscriber | 140 | Subscriber |
340 | 141 | >>> print notification['X-Launchpad-Message-For'] | ||
341 | 142 | source-subscriber | ||
342 | 139 | >>> print notification.get_payload(decode=True) | 143 | >>> print notification.get_payload(decode=True) |
343 | 140 | Eric has proposed merging | 144 | Eric has proposed merging |
344 | 141 | lp://dev/~person-name...into lp://dev/~person-name... | 145 | lp://dev/~person-name...into lp://dev/~person-name... |
345 | @@ -176,11 +180,12 @@ | |||
346 | 176 | >>> for notification in notifications: | 180 | >>> for notification in notifications: |
347 | 177 | ... print "%s, %s" % ( | 181 | ... print "%s, %s" % ( |
348 | 178 | ... notification['X-Envelope-To'], | 182 | ... notification['X-Envelope-To'], |
354 | 179 | ... notification['X-Launchpad-Message-Rationale']) | 183 | ... notification['X-Launchpad-Message-Rationale'], |
355 | 180 | bob@example.com, Reviewer | 184 | ... notification['X-Launchpad-Message-For']) |
356 | 181 | mary@example.com, Reviewer | 185 | bob@example.com, Reviewer, bob |
357 | 182 | source@example.com, Subscriber | 186 | mary@example.com, Reviewer, mary |
358 | 183 | target@example.com, Subscriber | 187 | source@example.com, Subscriber, source-subscriber |
359 | 188 | target@example.com, Subscriber, target-subscriber | ||
360 | 184 | >>> notification = notifications[0] | 189 | >>> notification = notifications[0] |
361 | 185 | >>> print notification.get_payload()[0].get_payload(decode=True) | 190 | >>> print notification.get_payload()[0].get_payload(decode=True) |
362 | 186 | Eric has proposed merging | 191 | Eric has proposed merging |
363 | 187 | 192 | ||
364 | === modified file 'lib/lp/code/doc/branch-notifications.txt' | |||
365 | --- lib/lp/code/doc/branch-notifications.txt 2015-09-02 16:54:24 +0000 | |||
366 | +++ lib/lp/code/doc/branch-notifications.txt 2015-09-11 12:44:20 +0000 | |||
367 | @@ -60,6 +60,8 @@ | |||
368 | 60 | ~name12/firefox/main | 60 | ~name12/firefox/main |
369 | 61 | >>> print branch_notification['X-Launchpad-Message-Rationale'] | 61 | >>> print branch_notification['X-Launchpad-Message-Rationale'] |
370 | 62 | Subscriber | 62 | Subscriber |
371 | 63 | >>> print branch_notification['X-Launchpad-Message-For'] | ||
372 | 64 | name12 | ||
373 | 63 | >>> notification_body = branch_notification.get_payload(decode=True) | 65 | >>> notification_body = branch_notification.get_payload(decode=True) |
374 | 64 | >>> print notification_body #doctest: -NORMALIZE_WHITESPACE | 66 | >>> print notification_body #doctest: -NORMALIZE_WHITESPACE |
375 | 65 | The contents. | 67 | The contents. |
376 | 66 | 68 | ||
377 | === modified file 'lib/lp/code/doc/codeimport.txt' | |||
378 | --- lib/lp/code/doc/codeimport.txt 2014-02-24 07:19:52 +0000 | |||
379 | +++ lib/lp/code/doc/codeimport.txt 2015-09-11 12:44:20 +0000 | |||
380 | @@ -100,6 +100,8 @@ | |||
381 | 100 | New code import: widget/trunk-cvs | 100 | New code import: widget/trunk-cvs |
382 | 101 | >>> print message['X-Launchpad-Message-Rationale'] | 101 | >>> print message['X-Launchpad-Message-Rationale'] |
383 | 102 | Operator @vcs-imports | 102 | Operator @vcs-imports |
384 | 103 | >>> print message['X-Launchpad-Message-For'] | ||
385 | 104 | vcs-imports | ||
386 | 103 | >>> print message.get_payload(decode=True) | 105 | >>> print message.get_payload(decode=True) |
387 | 104 | A new CVS code import has been requested by Code Import Person: | 106 | A new CVS code import has been requested by Code Import Person: |
388 | 105 | http://code.launchpad.dev/~import-person/widget/trunk-cvs | 107 | http://code.launchpad.dev/~import-person/widget/trunk-cvs |
389 | 106 | 108 | ||
390 | === modified file 'lib/lp/code/mail/codeimport.py' | |||
391 | --- lib/lp/code/mail/codeimport.py 2014-02-24 07:19:52 +0000 | |||
392 | +++ lib/lp/code/mail/codeimport.py 2015-09-11 12:44:20 +0000 | |||
393 | @@ -1,4 +1,4 @@ | |||
395 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2015 Canonical Ltd. This software is licensed under the |
396 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
397 | 3 | 3 | ||
398 | 4 | """Email notifications related to code imports.""" | 4 | """Email notifications related to code imports.""" |
399 | @@ -65,6 +65,7 @@ | |||
400 | 65 | headers = {'X-Launchpad-Branch': code_import.branch.unique_name, | 65 | headers = {'X-Launchpad-Branch': code_import.branch.unique_name, |
401 | 66 | 'X-Launchpad-Message-Rationale': | 66 | 'X-Launchpad-Message-Rationale': |
402 | 67 | 'Operator @%s' % vcs_imports.name, | 67 | 'Operator @%s' % vcs_imports.name, |
403 | 68 | 'X-Launchpad-Message-For': vcs_imports.name, | ||
404 | 68 | 'X-Launchpad-Notification-Type': 'code-import', | 69 | 'X-Launchpad-Notification-Type': 'code-import', |
405 | 69 | } | 70 | } |
406 | 70 | for address in get_contact_email_addresses(vcs_imports): | 71 | for address in get_contact_email_addresses(vcs_imports): |
407 | @@ -185,6 +186,7 @@ | |||
408 | 185 | else: | 186 | else: |
409 | 186 | template_params['rationale'] = rationale | 187 | template_params['rationale'] = rationale |
410 | 187 | template_params['unsubscribe'] = '' | 188 | template_params['unsubscribe'] = '' |
411 | 189 | for_person = vcs_imports | ||
412 | 188 | else: | 190 | else: |
413 | 189 | if subscription.notification_level in interested_levels: | 191 | if subscription.notification_level in interested_levels: |
414 | 190 | template_params['rationale'] = ( | 192 | template_params['rationale'] = ( |
415 | @@ -197,10 +199,12 @@ | |||
416 | 197 | "%s/+edit-subscription." % canonical_url(branch)) | 199 | "%s/+edit-subscription." % canonical_url(branch)) |
417 | 198 | else: | 200 | else: |
418 | 199 | template_params['unsubscribe'] = '' | 201 | template_params['unsubscribe'] = '' |
419 | 202 | for_person = subscription.person | ||
420 | 200 | else: | 203 | else: |
421 | 201 | # Don't send email to this subscriber. | 204 | # Don't send email to this subscriber. |
422 | 202 | continue | 205 | continue |
423 | 203 | 206 | ||
424 | 204 | headers['X-Launchpad-Message-Rationale'] = rationale | 207 | headers['X-Launchpad-Message-Rationale'] = rationale |
425 | 208 | headers['X-Launchpad-Message-For'] = for_person.name | ||
426 | 205 | body = email_template % template_params | 209 | body = email_template % template_params |
427 | 206 | simple_sendmail(from_address, email_address, subject, body, headers) | 210 | simple_sendmail(from_address, email_address, subject, body, headers) |
428 | 207 | 211 | ||
429 | === modified file 'lib/lp/code/mail/tests/test_branch.py' | |||
430 | --- lib/lp/code/mail/tests/test_branch.py 2015-09-02 16:54:24 +0000 | |||
431 | +++ lib/lp/code/mail/tests/test_branch.py 2015-09-11 12:44:20 +0000 | |||
432 | @@ -227,6 +227,7 @@ | |||
433 | 227 | self.assertEqual( | 227 | self.assertEqual( |
434 | 228 | {'X-Launchpad-Branch': branch.unique_name, | 228 | {'X-Launchpad-Branch': branch.unique_name, |
435 | 229 | 'X-Launchpad-Message-Rationale': 'Subscriber', | 229 | 'X-Launchpad-Message-Rationale': 'Subscriber', |
436 | 230 | 'X-Launchpad-Message-For': bob.name, | ||
437 | 230 | 'X-Launchpad-Notification-Type': 'branch-updated', | 231 | 'X-Launchpad-Notification-Type': 'branch-updated', |
438 | 231 | 'X-Launchpad-Project': self.getBranchProjectName(branch), | 232 | 'X-Launchpad-Project': self.getBranchProjectName(branch), |
439 | 232 | 'Message-Id': '<foobar-example-com>'}, | 233 | 'Message-Id': '<foobar-example-com>'}, |
440 | @@ -247,6 +248,7 @@ | |||
441 | 247 | self.assertEqual( | 248 | self.assertEqual( |
442 | 248 | {'X-Launchpad-Branch': branch.unique_name, | 249 | {'X-Launchpad-Branch': branch.unique_name, |
443 | 249 | 'X-Launchpad-Message-Rationale': 'Subscriber', | 250 | 'X-Launchpad-Message-Rationale': 'Subscriber', |
444 | 251 | 'X-Launchpad-Message-For': bob.name, | ||
445 | 250 | 'X-Launchpad-Notification-Type': 'branch-revision', | 252 | 'X-Launchpad-Notification-Type': 'branch-revision', |
446 | 251 | 'X-Launchpad-Branch-Revision-Number': '1', | 253 | 'X-Launchpad-Branch-Revision-Number': '1', |
447 | 252 | 'X-Launchpad-Project': self.getBranchProjectName(branch), | 254 | 'X-Launchpad-Project': self.getBranchProjectName(branch), |
448 | 253 | 255 | ||
449 | === modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py' | |||
450 | --- lib/lp/code/mail/tests/test_branchmergeproposal.py 2015-09-02 16:54:24 +0000 | |||
451 | +++ lib/lp/code/mail/tests/test_branchmergeproposal.py 2015-09-11 12:44:20 +0000 | |||
452 | @@ -135,6 +135,7 @@ | |||
453 | 135 | self.assertEqual( | 135 | self.assertEqual( |
454 | 136 | {'X-Launchpad-Branch': bmp.source_branch.unique_name, | 136 | {'X-Launchpad-Branch': bmp.source_branch.unique_name, |
455 | 137 | 'X-Launchpad-Message-Rationale': 'Subscriber', | 137 | 'X-Launchpad-Message-Rationale': 'Subscriber', |
456 | 138 | 'X-Launchpad-Message-For': subscriber.name, | ||
457 | 138 | 'X-Launchpad-Notification-Type': 'code-review', | 139 | 'X-Launchpad-Notification-Type': 'code-review', |
458 | 139 | 'X-Launchpad-Project': bmp.source_branch.product.name, | 140 | 'X-Launchpad-Project': bmp.source_branch.product.name, |
459 | 140 | 'Reply-To': bmp.address, | 141 | 'Reply-To': bmp.address, |
460 | 141 | 142 | ||
461 | === modified file 'lib/lp/code/mail/tests/test_codereviewcomment.py' | |||
462 | --- lib/lp/code/mail/tests/test_codereviewcomment.py 2015-09-08 11:56:33 +0000 | |||
463 | +++ lib/lp/code/mail/tests/test_codereviewcomment.py 2015-09-11 12:44:20 +0000 | |||
464 | @@ -164,6 +164,7 @@ | |||
465 | 164 | rationale = mailer._recipients.getReason('subscriber@example.com')[1] | 164 | rationale = mailer._recipients.getReason('subscriber@example.com')[1] |
466 | 165 | expected = {'X-Launchpad-Branch': source_branch.unique_name, | 165 | expected = {'X-Launchpad-Branch': source_branch.unique_name, |
467 | 166 | 'X-Launchpad-Message-Rationale': rationale, | 166 | 'X-Launchpad-Message-Rationale': rationale, |
468 | 167 | 'X-Launchpad-Message-For': subscriber.name, | ||
469 | 167 | 'X-Launchpad-Notification-Type': 'code-review', | 168 | 'X-Launchpad-Notification-Type': 'code-review', |
470 | 168 | 'X-Launchpad-Project': source_branch.product.name, | 169 | 'X-Launchpad-Project': source_branch.product.name, |
471 | 169 | 'Message-Id': message.rfc822msgid, | 170 | 'Message-Id': message.rfc822msgid, |
472 | @@ -221,6 +222,7 @@ | |||
473 | 221 | 'You are subscribed to branch %s.' % source_branch.bzr_identity, | 222 | 'You are subscribed to branch %s.' % source_branch.bzr_identity, |
474 | 222 | '', | 223 | '', |
475 | 223 | 'Launchpad-Message-Rationale: %s' % rationale, | 224 | 'Launchpad-Message-Rationale: %s' % rationale, |
476 | 225 | 'Launchpad-Message-For: %s' % subscriber.name, | ||
477 | 224 | 'Launchpad-Notification-Type: code-review', | 226 | 'Launchpad-Notification-Type: code-review', |
478 | 225 | 'Launchpad-Branch: %s' % source_branch.unique_name, | 227 | 'Launchpad-Branch: %s' % source_branch.unique_name, |
479 | 226 | 'Launchpad-Project: %s' % source_branch.product.name, | 228 | 'Launchpad-Project: %s' % source_branch.product.name, |
480 | 227 | 229 | ||
481 | === modified file 'lib/lp/code/mail/tests/test_sourcepackagerecipebuild.py' | |||
482 | --- lib/lp/code/mail/tests/test_sourcepackagerecipebuild.py 2015-09-02 16:54:24 +0000 | |||
483 | +++ lib/lp/code/mail/tests/test_sourcepackagerecipebuild.py 2015-09-11 12:44:20 +0000 | |||
484 | @@ -84,6 +84,8 @@ | |||
485 | 84 | self.assertEqual( | 84 | self.assertEqual( |
486 | 85 | 'Requester', ctrl.headers['X-Launchpad-Message-Rationale']) | 85 | 'Requester', ctrl.headers['X-Launchpad-Message-Rationale']) |
487 | 86 | self.assertEqual( | 86 | self.assertEqual( |
488 | 87 | build.requester.name, ctrl.headers['X-Launchpad-Message-For']) | ||
489 | 88 | self.assertEqual( | ||
490 | 87 | 'recipe-build-status', | 89 | 'recipe-build-status', |
491 | 88 | ctrl.headers['X-Launchpad-Notification-Type']) | 90 | ctrl.headers['X-Launchpad-Notification-Type']) |
492 | 89 | self.assertEqual( | 91 | self.assertEqual( |
493 | @@ -119,6 +121,8 @@ | |||
494 | 119 | self.assertEqual( | 121 | self.assertEqual( |
495 | 120 | 'Requester', ctrl.headers['X-Launchpad-Message-Rationale']) | 122 | 'Requester', ctrl.headers['X-Launchpad-Message-Rationale']) |
496 | 121 | self.assertEqual( | 123 | self.assertEqual( |
497 | 124 | build.requester.name, ctrl.headers['X-Launchpad-Message-For']) | ||
498 | 125 | self.assertEqual( | ||
499 | 122 | 'recipe-build-status', | 126 | 'recipe-build-status', |
500 | 123 | ctrl.headers['X-Launchpad-Notification-Type']) | 127 | ctrl.headers['X-Launchpad-Notification-Type']) |
501 | 124 | self.assertEqual( | 128 | self.assertEqual( |
502 | 125 | 129 | ||
503 | === modified file 'lib/lp/registry/browser/person.py' | |||
504 | --- lib/lp/registry/browser/person.py 2015-08-06 16:48:48 +0000 | |||
505 | +++ lib/lp/registry/browser/person.py 2015-09-11 12:44:20 +0000 | |||
506 | @@ -4327,7 +4327,7 @@ | |||
507 | 4327 | return | 4327 | return |
508 | 4328 | try: | 4328 | try: |
509 | 4329 | send_direct_contact_email( | 4329 | send_direct_contact_email( |
511 | 4330 | sender_email, self.recipients, subject, message) | 4330 | sender_email, self.recipients, self.context, subject, message) |
512 | 4331 | except QuotaReachedError as error: | 4331 | except QuotaReachedError as error: |
513 | 4332 | fmt_date = DateTimeFormatterAPI(self.next_try) | 4332 | fmt_date = DateTimeFormatterAPI(self.next_try) |
514 | 4333 | self.request.response.addErrorNotification( | 4333 | self.request.response.addErrorNotification( |
515 | 4334 | 4334 | ||
516 | === modified file 'lib/lp/registry/doc/teammembership-email-notification.txt' | |||
517 | --- lib/lp/registry/doc/teammembership-email-notification.txt 2015-09-02 02:46:18 +0000 | |||
518 | +++ lib/lp/registry/doc/teammembership-email-notification.txt 2015-09-11 12:44:20 +0000 | |||
519 | @@ -1067,10 +1067,11 @@ | |||
520 | 1067 | ... name='team-two', email='team-two@example.com', owner=owner) | 1067 | ... name='team-two', email='team-two@example.com', owner=owner) |
521 | 1068 | >>> ignored = team_one.addMember(team_two, owner, force_team_add=True) | 1068 | >>> ignored = team_one.addMember(team_two, owner, force_team_add=True) |
522 | 1069 | >>> run_mail_jobs() | 1069 | >>> run_mail_jobs() |
524 | 1070 | >>> print_distinct_emails() | 1070 | >>> print_distinct_emails(include_for=True) |
525 | 1071 | From: Team One ... | 1071 | From: Team One ... |
526 | 1072 | To: Team Two <team-two...> | 1072 | To: Team Two <team-two...> |
527 | 1073 | X-Launchpad-Message-Rationale: Member (team-one) @team-two | 1073 | X-Launchpad-Message-Rationale: Member (team-one) @team-two |
528 | 1074 | X-Launchpad-Message-For: team-two | ||
529 | 1074 | X-Launchpad-Notification-Type: team-membership-new | 1075 | X-Launchpad-Notification-Type: team-membership-new |
530 | 1075 | Subject: team-two joined team-one | 1076 | Subject: team-two joined team-one |
531 | 1076 | <BLANKLINE> | 1077 | <BLANKLINE> |
532 | 1077 | 1078 | ||
533 | === modified file 'lib/lp/registry/mail/notification.py' | |||
534 | --- lib/lp/registry/mail/notification.py 2015-09-02 02:46:18 +0000 | |||
535 | +++ lib/lp/registry/mail/notification.py 2015-09-11 12:44:20 +0000 | |||
536 | @@ -157,13 +157,15 @@ | |||
537 | 157 | 157 | ||
538 | 158 | 158 | ||
539 | 159 | def send_direct_contact_email( | 159 | def send_direct_contact_email( |
541 | 160 | sender_email, recipients_set, subject, body): | 160 | sender_email, recipients_set, person_or_team, subject, body): |
542 | 161 | """Send a direct user-to-user email. | 161 | """Send a direct user-to-user email. |
543 | 162 | 162 | ||
544 | 163 | :param sender_email: The email address of the sender. | 163 | :param sender_email: The email address of the sender. |
545 | 164 | :type sender_email: string | 164 | :type sender_email: string |
546 | 165 | :param recipients_set: The recipients. | 165 | :param recipients_set: The recipients. |
548 | 166 | :type recipients_set:' A ContactViaWebNotificationSet | 166 | :type recipients_set: `ContactViaWebNotificationSet` |
549 | 167 | :param person_or_team: The party that is the context of the email. | ||
550 | 168 | :type person_or_team: `IPerson` | ||
551 | 167 | :param subject: The Subject header. | 169 | :param subject: The Subject header. |
552 | 168 | :type subject: unicode | 170 | :type subject: unicode |
553 | 169 | :param body: The message body. | 171 | :param body: The message body. |
554 | @@ -209,7 +211,7 @@ | |||
555 | 209 | message = None | 211 | message = None |
556 | 210 | for recipient_email, recipient in recipients_set.getRecipientPersons(): | 212 | for recipient_email, recipient in recipients_set.getRecipientPersons(): |
557 | 211 | recipient_name = str(encode(recipient.displayname)) | 213 | recipient_name = str(encode(recipient.displayname)) |
559 | 212 | reason, rational_header = recipients_set.getReason(recipient_email) | 214 | reason, rationale_header = recipients_set.getReason(recipient_email) |
560 | 213 | reason = str(encode(reason)).replace('\n ', '\n') | 215 | reason = str(encode(reason)).replace('\n ', '\n') |
561 | 214 | formatted_body = mailwrapper.format(body, force_wrap=True) | 216 | formatted_body = mailwrapper.format(body, force_wrap=True) |
562 | 215 | formatted_body += additions % reason | 217 | formatted_body += additions % reason |
563 | @@ -219,7 +221,8 @@ | |||
564 | 219 | message['To'] = formataddr((recipient_name, recipient_email)) | 221 | message['To'] = formataddr((recipient_name, recipient_email)) |
565 | 220 | message['Subject'] = subject_header | 222 | message['Subject'] = subject_header |
566 | 221 | message['Message-ID'] = make_msgid('launchpad') | 223 | message['Message-ID'] = make_msgid('launchpad') |
568 | 222 | message['X-Launchpad-Message-Rationale'] = rational_header | 224 | message['X-Launchpad-Message-Rationale'] = rationale_header |
569 | 225 | message['X-Launchpad-Message-For'] = person_or_team.name | ||
570 | 223 | # Send the message. | 226 | # Send the message. |
571 | 224 | sendmail(message, bulk=False) | 227 | sendmail(message, bulk=False) |
572 | 225 | # Use the information from the last message sent to record the action | 228 | # Use the information from the last message sent to record the action |
573 | 226 | 229 | ||
574 | === modified file 'lib/lp/registry/model/productjob.py' | |||
575 | --- lib/lp/registry/model/productjob.py 2015-07-09 20:06:17 +0000 | |||
576 | +++ lib/lp/registry/model/productjob.py 2015-09-11 12:44:20 +0000 | |||
577 | @@ -1,4 +1,4 @@ | |||
579 | 1 | # Copyright 2012 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2012-2015 Canonical Ltd. This software is licensed under the |
580 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
581 | 3 | 3 | ||
582 | 4 | """Jobs classes to update products and send notifications.""" | 4 | """Jobs classes to update products and send notifications.""" |
583 | @@ -321,6 +321,7 @@ | |||
584 | 321 | 'X-Launchpad-Project': | 321 | 'X-Launchpad-Project': |
585 | 322 | '%(product_displayname)s (%(product_name)s)' % message_data, | 322 | '%(product_displayname)s (%(product_name)s)' % message_data, |
586 | 323 | 'X-Launchpad-Message-Rationale': rationale, | 323 | 'X-Launchpad-Message-Rationale': rationale, |
587 | 324 | 'X-Launchpad-Message-For': self.product.owner.name, | ||
588 | 324 | } | 325 | } |
589 | 325 | if reply_to is not None: | 326 | if reply_to is not None: |
590 | 326 | headers['Reply-To'] = reply_to | 327 | headers['Reply-To'] = reply_to |
591 | 327 | 328 | ||
592 | === modified file 'lib/lp/registry/tests/test_notification.py' | |||
593 | --- lib/lp/registry/tests/test_notification.py 2012-12-26 01:04:05 +0000 | |||
594 | +++ lib/lp/registry/tests/test_notification.py 2015-09-11 12:44:20 +0000 | |||
595 | @@ -1,4 +1,4 @@ | |||
597 | 1 | # Copyright 2012 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2012-2015 Canonical Ltd. This software is licensed under the |
598 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
599 | 3 | 3 | ||
600 | 4 | """Test notification classes and functions.""" | 4 | """Test notification classes and functions.""" |
601 | @@ -28,7 +28,8 @@ | |||
602 | 28 | recipients_set = NotificationRecipientSet() | 28 | recipients_set = NotificationRecipientSet() |
603 | 29 | recipients_set.add(user, 'test reason', 'test rationale') | 29 | recipients_set.add(user, 'test reason', 'test rationale') |
604 | 30 | pop_notifications() | 30 | pop_notifications() |
606 | 31 | send_direct_contact_email('me@eg.dom', recipients_set, subject, body) | 31 | send_direct_contact_email( |
607 | 32 | 'me@eg.dom', recipients_set, user, subject, body) | ||
608 | 32 | notifications = pop_notifications() | 33 | notifications = pop_notifications() |
609 | 33 | notification = notifications[0] | 34 | notification = notifications[0] |
610 | 34 | self.assertEqual(1, len(notifications)) | 35 | self.assertEqual(1, len(notifications)) |
611 | @@ -37,6 +38,7 @@ | |||
612 | 37 | self.assertEqual(subject, notification['Subject']) | 38 | self.assertEqual(subject, notification['Subject']) |
613 | 38 | self.assertEqual( | 39 | self.assertEqual( |
614 | 39 | 'test rationale', notification['X-Launchpad-Message-Rationale']) | 40 | 'test rationale', notification['X-Launchpad-Message-Rationale']) |
615 | 41 | self.assertEqual(user.name, notification['X-Launchpad-Message-For']) | ||
616 | 40 | self.assertIs(None, notification['Precedence']) | 42 | self.assertIs(None, notification['Precedence']) |
617 | 41 | self.assertTrue('launchpad' in notification['Message-ID']) | 43 | self.assertTrue('launchpad' in notification['Message-ID']) |
618 | 42 | self.assertEqual( | 44 | self.assertEqual( |
619 | @@ -61,7 +63,7 @@ | |||
620 | 61 | authorization.record(old_message) | 63 | authorization.record(old_message) |
621 | 62 | self.assertRaises( | 64 | self.assertRaises( |
622 | 63 | QuotaReachedError, send_direct_contact_email, | 65 | QuotaReachedError, send_direct_contact_email, |
624 | 64 | 'me@eg.dom', recipients_set, 'subject', 'body') | 66 | 'me@eg.dom', recipients_set, user, 'subject', 'body') |
625 | 65 | 67 | ||
626 | 66 | def test_empty_recipient_set(self): | 68 | def test_empty_recipient_set(self): |
627 | 67 | # The recipient set can be empty. No messages are sent and the | 69 | # The recipient set can be empty. No messages are sent and the |
628 | @@ -75,7 +77,7 @@ | |||
629 | 75 | authorization.record(old_message) | 77 | authorization.record(old_message) |
630 | 76 | pop_notifications() | 78 | pop_notifications() |
631 | 77 | send_direct_contact_email( | 79 | send_direct_contact_email( |
633 | 78 | 'me@eg.dom', recipients_set, 'subject', 'body') | 80 | 'me@eg.dom', recipients_set, user, 'subject', 'body') |
634 | 79 | notifications = pop_notifications() | 81 | notifications = pop_notifications() |
635 | 80 | self.assertEqual(0, len(notifications)) | 82 | self.assertEqual(0, len(notifications)) |
636 | 81 | self.assertTrue(authorization.is_allowed) | 83 | self.assertTrue(authorization.is_allowed) |
637 | @@ -87,7 +89,8 @@ | |||
638 | 87 | recipients_set.add(user, 'test reason', 'test rationale') | 89 | recipients_set.add(user, 'test reason', 'test rationale') |
639 | 88 | pop_notifications() | 90 | pop_notifications() |
640 | 89 | body = 'Can you help me? ' * 8 | 91 | body = 'Can you help me? ' * 8 |
642 | 90 | send_direct_contact_email('me@eg.dom', recipients_set, 'subject', body) | 92 | send_direct_contact_email( |
643 | 93 | 'me@eg.dom', recipients_set, user, 'subject', body) | ||
644 | 91 | notifications = pop_notifications() | 94 | notifications = pop_notifications() |
645 | 92 | body, footer = notifications[0].get_payload().split('-- ') | 95 | body, footer = notifications[0].get_payload().split('-- ') |
646 | 93 | self.assertEqual( | 96 | self.assertEqual( |
647 | @@ -105,7 +108,8 @@ | |||
648 | 105 | recipients_set = NotificationRecipientSet() | 108 | recipients_set = NotificationRecipientSet() |
649 | 106 | recipients_set.add(user, 'test reason', 'test rationale') | 109 | recipients_set.add(user, 'test reason', 'test rationale') |
650 | 107 | pop_notifications() | 110 | pop_notifications() |
652 | 108 | send_direct_contact_email('me@eg.dom', recipients_set, 'test', 'test') | 111 | send_direct_contact_email( |
653 | 112 | 'me@eg.dom', recipients_set, user, 'test', 'test') | ||
654 | 109 | notifications = pop_notifications() | 113 | notifications = pop_notifications() |
655 | 110 | notification = notifications[0] | 114 | notification = notifications[0] |
656 | 111 | self.assertEqual( | 115 | self.assertEqual( |
657 | 112 | 116 | ||
658 | === modified file 'lib/lp/registry/tests/test_productjob.py' | |||
659 | --- lib/lp/registry/tests/test_productjob.py 2015-07-08 16:05:11 +0000 | |||
660 | +++ lib/lp/registry/tests/test_productjob.py 2015-09-11 12:44:20 +0000 | |||
661 | @@ -1,4 +1,4 @@ | |||
663 | 1 | # Copyright 2010-2012 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2015 Canonical Ltd. This software is licensed under the |
664 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
665 | 3 | 3 | ||
666 | 4 | """Tests for ProductJobs.""" | 4 | """Tests for ProductJobs.""" |
667 | @@ -442,6 +442,7 @@ | |||
668 | 442 | ('X-Launchpad-Project', '%s (%s)' % | 442 | ('X-Launchpad-Project', '%s (%s)' % |
669 | 443 | (product.displayname, product.name)), | 443 | (product.displayname, product.name)), |
670 | 444 | ('X-Launchpad-Message-Rationale', 'Maintainer'), | 444 | ('X-Launchpad-Message-Rationale', 'Maintainer'), |
671 | 445 | ('X-Launchpad-Message-For', product.owner.name), | ||
672 | 445 | ('Reply-To', reply_to), | 446 | ('Reply-To', reply_to), |
673 | 446 | ] | 447 | ] |
674 | 447 | self.assertContentEqual(expected_headers, headers.items()) | 448 | self.assertContentEqual(expected_headers, headers.items()) |
675 | @@ -458,6 +459,7 @@ | |||
676 | 458 | ('X-Launchpad-Project', '%s (%s)' % | 459 | ('X-Launchpad-Project', '%s (%s)' % |
677 | 459 | (product.displayname, product.name)), | 460 | (product.displayname, product.name)), |
678 | 460 | ('X-Launchpad-Message-Rationale', 'Maintainer'), | 461 | ('X-Launchpad-Message-Rationale', 'Maintainer'), |
679 | 462 | ('X-Launchpad-Message-For', product.owner.name), | ||
680 | 461 | ] | 463 | ] |
681 | 462 | self.assertContentEqual(expected_headers, headers.items()) | 464 | self.assertContentEqual(expected_headers, headers.items()) |
682 | 463 | 465 | ||
683 | 464 | 466 | ||
684 | === modified file 'lib/lp/services/mail/basemailer.py' | |||
685 | --- lib/lp/services/mail/basemailer.py 2015-08-27 14:34:21 +0000 | |||
686 | +++ lib/lp/services/mail/basemailer.py 2015-09-11 12:44:20 +0000 | |||
687 | @@ -123,6 +123,8 @@ | |||
688 | 123 | reason, rationale = self._recipients.getReason(email) | 123 | reason, rationale = self._recipients.getReason(email) |
689 | 124 | headers = OrderedDict() | 124 | headers = OrderedDict() |
690 | 125 | headers['X-Launchpad-Message-Rationale'] = reason.mail_header | 125 | headers['X-Launchpad-Message-Rationale'] = reason.mail_header |
691 | 126 | if reason.subscriber.name is not None: | ||
692 | 127 | headers['X-Launchpad-Message-For'] = reason.subscriber.name | ||
693 | 126 | if self.notification_type is not None: | 128 | if self.notification_type is not None: |
694 | 127 | headers['X-Launchpad-Notification-Type'] = self.notification_type | 129 | headers['X-Launchpad-Notification-Type'] = self.notification_type |
695 | 128 | reply_to = self._getReplyToAddress(email, recipient) | 130 | reply_to = self._getReplyToAddress(email, recipient) |
696 | 129 | 131 | ||
697 | === modified file 'lib/lp/services/mail/notificationrecipientset.py' | |||
698 | --- lib/lp/services/mail/notificationrecipientset.py 2015-08-26 13:41:21 +0000 | |||
699 | +++ lib/lp/services/mail/notificationrecipientset.py 2015-09-11 12:44:20 +0000 | |||
700 | @@ -29,6 +29,7 @@ | |||
701 | 29 | correspond to a real Person. | 29 | correspond to a real Person. |
702 | 30 | """ | 30 | """ |
703 | 31 | 31 | ||
704 | 32 | name = None | ||
705 | 32 | displayname = None | 33 | displayname = None |
706 | 33 | is_team = False | 34 | is_team = False |
707 | 34 | expanded_notification_footers = False | 35 | expanded_notification_footers = False |
708 | 35 | 36 | ||
709 | === modified file 'lib/lp/services/mail/tests/test_basemailer.py' | |||
710 | --- lib/lp/services/mail/tests/test_basemailer.py 2015-08-23 22:53:55 +0000 | |||
711 | +++ lib/lp/services/mail/tests/test_basemailer.py 2015-09-11 12:44:20 +0000 | |||
712 | @@ -168,7 +168,8 @@ | |||
713 | 168 | def test_generateEmail_append_expanded_footer(self): | 168 | def test_generateEmail_append_expanded_footer(self): |
714 | 169 | # Recipients with expanded_notification_footers receive an expanded | 169 | # Recipients with expanded_notification_footers receive an expanded |
715 | 170 | # footer on messages. | 170 | # footer on messages. |
717 | 171 | fake_to = self.factory.makePerson(email='to@example.com') | 171 | fake_to = self.factory.makePerson( |
718 | 172 | name='to-person', email='to@example.com') | ||
719 | 172 | fake_to.expanded_notification_footers = True | 173 | fake_to.expanded_notification_footers = True |
720 | 173 | recipients = {fake_to: FakeSubscription()} | 174 | recipients = {fake_to: FakeSubscription()} |
721 | 174 | mailer = BaseMailerSubclass( | 175 | mailer = BaseMailerSubclass( |
722 | @@ -179,6 +180,7 @@ | |||
723 | 179 | ctrl.body, EndsWith( | 180 | ctrl.body, EndsWith( |
724 | 180 | '\n-- \n' | 181 | '\n-- \n' |
725 | 181 | 'Launchpad-Message-Rationale: pete\n' | 182 | 'Launchpad-Message-Rationale: pete\n' |
726 | 183 | 'Launchpad-Message-For: to-person\n' | ||
727 | 182 | 'Launchpad-Notification-Type: test\n')) | 184 | 'Launchpad-Notification-Type: test\n')) |
728 | 183 | 185 | ||
729 | 184 | def test_sendall_single_failure_doesnt_kill_all(self): | 186 | def test_sendall_single_failure_doesnt_kill_all(self): |
730 | 185 | 187 | ||
731 | === modified file 'lib/lp/snappy/tests/test_snapbuild.py' | |||
732 | --- lib/lp/snappy/tests/test_snapbuild.py 2015-08-03 13:20:45 +0000 | |||
733 | +++ lib/lp/snappy/tests/test_snapbuild.py 2015-09-11 12:44:20 +0000 | |||
734 | @@ -255,6 +255,7 @@ | |||
735 | 255 | "unstable" % build.id, subject) | 255 | "unstable" % build.id, subject) |
736 | 256 | self.assertEqual( | 256 | self.assertEqual( |
737 | 257 | "Requester", notification["X-Launchpad-Message-Rationale"]) | 257 | "Requester", notification["X-Launchpad-Message-Rationale"]) |
738 | 258 | self.assertEqual(person.name, notification["X-Launchpad-Message-For"]) | ||
739 | 258 | self.assertEqual( | 259 | self.assertEqual( |
740 | 259 | "snap-build-status", | 260 | "snap-build-status", |
741 | 260 | notification["X-Launchpad-Notification-Type"]) | 261 | notification["X-Launchpad-Notification-Type"]) |
742 | 261 | 262 | ||
743 | === modified file 'lib/lp/soyuz/mail/tests/test_packageupload.py' | |||
744 | --- lib/lp/soyuz/mail/tests/test_packageupload.py 2015-08-25 23:27:09 +0000 | |||
745 | +++ lib/lp/soyuz/mail/tests/test_packageupload.py 2015-09-11 12:44:20 +0000 | |||
746 | @@ -132,6 +132,7 @@ | |||
747 | 132 | "X-Launchpad-Message-Rationale": Equals("Announcement"), | 132 | "X-Launchpad-Message-Rationale": Equals("Announcement"), |
748 | 133 | "X-Launchpad-Notification-Type": Equals("package-upload"), | 133 | "X-Launchpad-Notification-Type": Equals("package-upload"), |
749 | 134 | })) | 134 | })) |
750 | 135 | self.assertNotIn("X-Launchpad-Message-For", dict(notifications[1])) | ||
751 | 135 | 136 | ||
752 | 136 | def test_forAction_announce_from_person_override_with_unicode_names(self): | 137 | def test_forAction_announce_from_person_override_with_unicode_names(self): |
753 | 137 | # PackageUploadMailer.forAction() takes an optional | 138 | # PackageUploadMailer.forAction() takes an optional |
754 | @@ -164,6 +165,7 @@ | |||
755 | 164 | "X-Launchpad-Message-Rationale": Equals("Announcement"), | 165 | "X-Launchpad-Message-Rationale": Equals("Announcement"), |
756 | 165 | "X-Launchpad-Notification-Type": Equals("package-upload"), | 166 | "X-Launchpad-Notification-Type": Equals("package-upload"), |
757 | 166 | })) | 167 | })) |
758 | 168 | self.assertNotIn("X-Launchpad-Message-For", dict(notifications[1])) | ||
759 | 167 | 169 | ||
760 | 168 | def test_forAction_bcc_to_derivatives_list(self): | 170 | def test_forAction_bcc_to_derivatives_list(self): |
761 | 169 | # PackageUploadMailer.forAction() will BCC the announcement email to | 171 | # PackageUploadMailer.forAction() will BCC the announcement email to |
762 | @@ -186,6 +188,7 @@ | |||
763 | 186 | "X-Launchpad-Message-Rationale": Equals("Announcement"), | 188 | "X-Launchpad-Message-Rationale": Equals("Announcement"), |
764 | 187 | "X-Launchpad-Notification-Type": Equals("package-upload"), | 189 | "X-Launchpad-Notification-Type": Equals("package-upload"), |
765 | 188 | })) | 190 | })) |
766 | 191 | self.assertNotIn("X-Launchpad-Message-For", dict(notifications[1])) | ||
767 | 189 | 192 | ||
768 | 190 | def test_fetch_information_spr_multiple_changelogs(self): | 193 | def test_fetch_information_spr_multiple_changelogs(self): |
769 | 191 | # If previous_version is passed the "changelog" entry in the | 194 | # If previous_version is passed the "changelog" entry in the |
770 | @@ -454,15 +457,17 @@ | |||
771 | 454 | "accepted", blamer, spr, [], [], archive, distroseries, | 457 | "accepted", blamer, spr, [], [], archive, distroseries, |
772 | 455 | PackagePublishingPocket.RELEASE, changes=changes) | 458 | PackagePublishingPocket.RELEASE, changes=changes) |
773 | 456 | recipients = dict(mailer._recipients.getRecipientPersons()) | 459 | recipients = dict(mailer._recipients.getRecipientPersons()) |
778 | 457 | for email, rationale in ( | 460 | for person, rationale in ( |
779 | 458 | (blamer.preferredemail.email, "Requester"), | 461 | (blamer, "Requester"), |
780 | 459 | ("maintainer@example.com", "Maintainer"), | 462 | (maintainer, "Maintainer"), |
781 | 460 | ("changer@example.com", "Changed-By")): | 463 | (changer, "Changed-By")): |
782 | 464 | email = person.preferredemail.email | ||
783 | 461 | headers = mailer._getHeaders(email, recipients[email]) | 465 | headers = mailer._getHeaders(email, recipients[email]) |
784 | 462 | self.assertThat( | 466 | self.assertThat( |
785 | 463 | headers, | 467 | headers, |
786 | 464 | ContainsDict({ | 468 | ContainsDict({ |
787 | 465 | "X-Launchpad-Message-Rationale": Equals(rationale), | 469 | "X-Launchpad-Message-Rationale": Equals(rationale), |
788 | 470 | "X-Launchpad-Message-For": Equals(person.name), | ||
789 | 466 | "X-Launchpad-Notification-Type": Equals("package-upload"), | 471 | "X-Launchpad-Notification-Type": Equals("package-upload"), |
790 | 467 | "X-Katie": Equals("Launchpad actually"), | 472 | "X-Katie": Equals("Launchpad actually"), |
791 | 468 | "X-Launchpad-Archive": Equals(archive.reference), | 473 | "X-Launchpad-Archive": Equals(archive.reference), |
792 | @@ -497,14 +502,16 @@ | |||
793 | 497 | "accepted", blamer, spr, [], [], archive, distroseries, | 502 | "accepted", blamer, spr, [], [], archive, distroseries, |
794 | 498 | PackagePublishingPocket.RELEASE, changes=changes) | 503 | PackagePublishingPocket.RELEASE, changes=changes) |
795 | 499 | recipients = dict(mailer._recipients.getRecipientPersons()) | 504 | recipients = dict(mailer._recipients.getRecipientPersons()) |
799 | 500 | for email, rationale in ( | 505 | for person, rationale in ( |
800 | 501 | (blamer.preferredemail.email, "Requester"), | 506 | (blamer, "Requester"), |
801 | 502 | (uploader.preferredemail.email, "PPA Uploader")): | 507 | (uploader, "PPA Uploader")): |
802 | 508 | email = person.preferredemail.email | ||
803 | 503 | headers = mailer._getHeaders(email, recipients[email]) | 509 | headers = mailer._getHeaders(email, recipients[email]) |
804 | 504 | self.assertThat( | 510 | self.assertThat( |
805 | 505 | headers, | 511 | headers, |
806 | 506 | ContainsDict({ | 512 | ContainsDict({ |
807 | 507 | "X-Launchpad-Message-Rationale": Equals(rationale), | 513 | "X-Launchpad-Message-Rationale": Equals(rationale), |
808 | 514 | "X-Launchpad-Message-For": Equals(person.name), | ||
809 | 508 | "X-Launchpad-Notification-Type": Equals("package-upload"), | 515 | "X-Launchpad-Notification-Type": Equals("package-upload"), |
810 | 509 | "X-Katie": Equals("Launchpad actually"), | 516 | "X-Katie": Equals("Launchpad actually"), |
811 | 510 | "X-Launchpad-Archive": Equals(archive.reference), | 517 | "X-Launchpad-Archive": Equals(archive.reference), |
812 | 511 | 518 | ||
813 | === modified file 'lib/lp/soyuz/tests/test_build_notify.py' | |||
814 | --- lib/lp/soyuz/tests/test_build_notify.py 2015-09-04 12:19:07 +0000 | |||
815 | +++ lib/lp/soyuz/tests/test_build_notify.py 2015-09-11 12:44:20 +0000 | |||
816 | @@ -105,10 +105,13 @@ | |||
817 | 105 | format_address_for_person(recipient), notification['To']) | 105 | format_address_for_person(recipient), notification['To']) |
818 | 106 | if reason == "buildd-admin": | 106 | if reason == "buildd-admin": |
819 | 107 | rationale = "Buildd-Admin @launchpad-buildd-admins" | 107 | rationale = "Buildd-Admin @launchpad-buildd-admins" |
820 | 108 | expected_for = "launchpad-buildd-admins" | ||
821 | 108 | else: | 109 | else: |
822 | 109 | rationale = reason.title() | 110 | rationale = reason.title() |
823 | 111 | expected_for = recipient.name | ||
824 | 110 | self.assertEqual( | 112 | self.assertEqual( |
825 | 111 | rationale, notification['X-Launchpad-Message-Rationale']) | 113 | rationale, notification['X-Launchpad-Message-Rationale']) |
826 | 114 | self.assertEqual(expected_for, notification['X-Launchpad-Message-For']) | ||
827 | 112 | self.assertEqual( | 115 | self.assertEqual( |
828 | 113 | 'package-build-status', | 116 | 'package-build-status', |
829 | 114 | notification['X-Launchpad-Notification-Type']) | 117 | notification['X-Launchpad-Notification-Type']) |
830 | 115 | 118 | ||
831 | === modified file 'lib/lp/soyuz/tests/test_livefsbuild.py' | |||
832 | --- lib/lp/soyuz/tests/test_livefsbuild.py 2015-08-03 12:59:18 +0000 | |||
833 | +++ lib/lp/soyuz/tests/test_livefsbuild.py 2015-09-11 12:44:20 +0000 | |||
834 | @@ -1,4 +1,4 @@ | |||
836 | 1 | # Copyright 2014 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2014-2015 Canonical Ltd. This software is licensed under the |
837 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
838 | 3 | 3 | ||
839 | 4 | """Test live filesystem build features.""" | 4 | """Test live filesystem build features.""" |
840 | @@ -257,6 +257,7 @@ | |||
841 | 257 | "unstable" % build.id, subject) | 257 | "unstable" % build.id, subject) |
842 | 258 | self.assertEqual( | 258 | self.assertEqual( |
843 | 259 | "Requester", notification["X-Launchpad-Message-Rationale"]) | 259 | "Requester", notification["X-Launchpad-Message-Rationale"]) |
844 | 260 | self.assertEqual(person.name, notification["X-Launchpad-Message-For"]) | ||
845 | 260 | self.assertEqual( | 261 | self.assertEqual( |
846 | 261 | "livefs-build-status", | 262 | "livefs-build-status", |
847 | 262 | notification["X-Launchpad-Notification-Type"]) | 263 | notification["X-Launchpad-Notification-Type"]) |
848 | 263 | 264 | ||
849 | === modified file 'lib/lp/testing/mail_helpers.py' | |||
850 | --- lib/lp/testing/mail_helpers.py 2015-09-02 02:46:18 +0000 | |||
851 | +++ lib/lp/testing/mail_helpers.py 2015-09-11 12:44:20 +0000 | |||
852 | @@ -60,8 +60,8 @@ | |||
853 | 60 | 60 | ||
854 | 61 | 61 | ||
855 | 62 | def print_emails(include_reply_to=False, group_similar=False, | 62 | def print_emails(include_reply_to=False, group_similar=False, |
858 | 63 | include_rationale=False, notifications=None, | 63 | include_rationale=False, include_for=False, |
859 | 64 | include_notification_type=False): | 64 | notifications=None, include_notification_type=False): |
860 | 65 | """Pop all messages from stub.test_emails and print them with | 65 | """Pop all messages from stub.test_emails and print them with |
861 | 66 | their recipients. | 66 | their recipients. |
862 | 67 | 67 | ||
863 | @@ -76,6 +76,7 @@ | |||
864 | 76 | :param group_similar: Group messages sent to multiple recipients if True. | 76 | :param group_similar: Group messages sent to multiple recipients if True. |
865 | 77 | :param include_rationale: Include the X-Launchpad-Message-Rationale | 77 | :param include_rationale: Include the X-Launchpad-Message-Rationale |
866 | 78 | header. | 78 | header. |
867 | 79 | :param include_for: Include the X-Launchpad-Message-For header. | ||
868 | 79 | :param notifications: Use the provided list of notifications instead of | 80 | :param notifications: Use the provided list of notifications instead of |
869 | 80 | the stack. | 81 | the stack. |
870 | 81 | :param include_notification_type: Include the | 82 | :param include_notification_type: Include the |
871 | @@ -106,8 +107,10 @@ | |||
872 | 106 | print 'Reply-To:', message['Reply-To'] | 107 | print 'Reply-To:', message['Reply-To'] |
873 | 107 | rationale_header = 'X-Launchpad-Message-Rationale' | 108 | rationale_header = 'X-Launchpad-Message-Rationale' |
874 | 108 | if include_rationale and rationale_header in message: | 109 | if include_rationale and rationale_header in message: |
877 | 109 | print ( | 110 | print '%s: %s' % (rationale_header, message[rationale_header]) |
878 | 110 | '%s: %s' % (rationale_header, message[rationale_header])) | 111 | for_header = 'X-Launchpad-Message-For' |
879 | 112 | if include_for and for_header in message: | ||
880 | 113 | print '%s: %s' % (for_header, message[for_header]) | ||
881 | 111 | notification_type_header = 'X-Launchpad-Notification-Type' | 114 | notification_type_header = 'X-Launchpad-Notification-Type' |
882 | 112 | if include_notification_type and notification_type_header in message: | 115 | if include_notification_type and notification_type_header in message: |
883 | 113 | print '%s: %s' % ( | 116 | print '%s: %s' % ( |
884 | @@ -118,11 +121,12 @@ | |||
885 | 118 | 121 | ||
886 | 119 | 122 | ||
887 | 120 | def print_distinct_emails(include_reply_to=False, include_rationale=True, | 123 | def print_distinct_emails(include_reply_to=False, include_rationale=True, |
889 | 121 | include_notification_type=True): | 124 | include_for=False, include_notification_type=True): |
890 | 122 | """A convenient shortcut for `print_emails`(group_similar=True).""" | 125 | """A convenient shortcut for `print_emails`(group_similar=True).""" |
891 | 123 | return print_emails(group_similar=True, | 126 | return print_emails(group_similar=True, |
892 | 124 | include_reply_to=include_reply_to, | 127 | include_reply_to=include_reply_to, |
893 | 125 | include_rationale=include_rationale, | 128 | include_rationale=include_rationale, |
894 | 129 | include_for=include_for, | ||
895 | 126 | include_notification_type=include_notification_type) | 130 | include_notification_type=include_notification_type) |
896 | 127 | 131 | ||
897 | 128 | 132 |