Merge lp:~benji/launchpad/bug-649252 into lp:launchpad

Proposed by Benji York
Status: Merged
Approved by: Benji York
Approved revision: no longer in the source branch.
Merged at revision: 12396
Proposed branch: lp:~benji/launchpad/bug-649252
Merge into: lp:launchpad
Diff against target: 193 lines (+21/-22)
3 files modified
lib/canonical/launchpad/emailtemplates/bug-notification.txt (+2/-0)
lib/lp/bugs/doc/bugnotification-sending.txt (+18/-21)
lib/lp/bugs/scripts/bugnotification.py (+1/-1)
To merge this branch: bzr merge lp:~benji/launchpad/bug-649252
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Approve
Review via email: mp+49876@code.launchpad.net

Commit message

[r=leonardr][bug=649252] add an unsubscribe link to non-verbose bug notifications

Description of the change

When LP users check the "Include bug descriptions when sending me bug
notifications" option on their profile they get "verbose" emails that
include an unsubscribe link in messages about bugs to which they are
directly subscribed. If they do not check that option, they get shorter
email messages that do not include the unsubscribe link.

This branch changes the behavior so that the unsubscribe link is always
present.

The doctest (lib/canonical/launchpad/emailtemplates/bug-notification.txt)
that deals with bug notification emails needed a couple of changes
because of the new contents of the email and I added a small section to
explicitly call out the unsubscribe link in the non-verbose email
messages.

My lint is broken so I don't have anything to say there. If I get it
fixed I'll update the MP.

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) wrote :

"Neither does Verbose Team Person" doesn't make sense anymore--you should change it to something like "Verbose Team Person gets a concise email, even though they belong to a team that gets verbose email."

I also don't understand why you added the two blank lines starting on line 44 of the diff.

This looks good otherwise.

review: Approve
Revision history for this message
Benji York (benji) wrote :

> "Neither does Verbose Team Person" doesn't make sense anymore--you should
> change it to something like "Verbose Team Person gets a concise email, even
> though they belong to a team that gets verbose email."

Thanks. Fixed.

> I also don't understand why you added the two blank lines starting on line 44
> of the diff.

The way Python string formatting is used to fill in the templates causes
trailing newlines. I just fixed this by adding a .strip() to the email
body after the template is filled in. I was then able to remove all the
trailing <BLANKLINE>s in the test.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification.txt'
2--- lib/canonical/launchpad/emailtemplates/bug-notification.txt 2011-01-06 14:43:46 +0000
3+++ lib/canonical/launchpad/emailtemplates/bug-notification.txt 2011-02-16 14:15:40 +0000
4@@ -6,3 +6,5 @@
5
6 Title:
7 %(bug_title)s
8+
9+%(unsubscribe_notice)s
10
11=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
12--- lib/lp/bugs/doc/bugnotification-sending.txt 2011-02-08 14:34:55 +0000
13+++ lib/lp/bugs/doc/bugnotification-sending.txt 2011-02-16 14:15:40 +0000
14@@ -80,7 +80,6 @@
15 <BLANKLINE>
16 Title:
17 Firefox does not support SVG
18- <BLANKLINE>
19 ----------------------------------------------------------------------
20 To: mark@example.com
21 From: Sample Person <1@bugs.launchpad.net>
22@@ -95,7 +94,6 @@
23 <BLANKLINE>
24 Title:
25 Firefox does not support SVG
26- <BLANKLINE>
27 ----------------------------------------------------------------------
28 To: support@ubuntu.com
29 From: Sample Person <1@bugs.launchpad.net>
30@@ -111,7 +109,6 @@
31 <BLANKLINE>
32 Title:
33 Firefox does not support SVG
34- <BLANKLINE>
35 ----------------------------------------------------------------------
36 To: test@canonical.com
37 From: Sample Person <1@bugs.launchpad.net>
38@@ -128,6 +125,7 @@
39 Title:
40 Firefox does not support SVG
41 <BLANKLINE>
42+ ...
43 ----------------------------------------------------------------------
44
45 You can see that the message above contains the bug's initial comment's
46@@ -249,7 +247,6 @@
47 <BLANKLINE>
48 Title:
49 Firefox does not support SVG
50- <BLANKLINE>
51 ----------------------------------------------------------------------
52 To: test@canonical.com
53 ...
54@@ -343,7 +340,7 @@
55 'http://bugs.launchpad.dev/bugs/1',
56 '',
57 'Title:',
58- ' Firefox does not support SVG']
59+ ' Firefox does not support SVG'...]
60
61 >>> flush_notifications()
62
63@@ -429,14 +426,13 @@
64 <BLANKLINE>
65 a comment.
66 <BLANKLINE>
67- --
68+ --
69 You received this bug notification because you are a member of Ubuntu
70 Team, which is the registrant for Ubuntu.
71 http://bugs.launchpad.dev/bugs/16
72 <BLANKLINE>
73 Title:
74 new bug
75- <BLANKLINE>
76 ----------------------------------------------------------------------
77 To: test@canonical.com
78 From: Sample Person <16@bugs.launchpad.net>
79@@ -448,7 +444,7 @@
80 <BLANKLINE>
81 a comment.
82 <BLANKLINE>
83- --
84+ --
85 You received this bug notification because you are a direct subscriber
86 of the bug.
87 http://bugs.launchpad.dev/bugs/16
88@@ -456,6 +452,8 @@
89 Title:
90 new bug
91 <BLANKLINE>
92+ To unsubscribe from this bug, go to:
93+ http://bugs.launchpad.dev/ubuntu/+bug/16/+subscribe
94 ----------------------------------------------------------------------
95
96 >>> flush_notifications()
97@@ -982,11 +980,17 @@
98 <BLANKLINE>
99 Title:
100 In the beginning...
101- <BLANKLINE>
102 ----------------------------------------------------------------------
103
104-Neither does Verbose Team Person - while the team wants verbose emails,
105-he wants concise ones.
106+However, Concise Person does get an unsubscribe link.
107+
108+ >>> print_notification(collated_messages['concise@example.com'][0])
109+ To: concise@example.com
110+ ...
111+ To unsubscribe from this bug, go to:...
112+
113+Verbose Team Person gets a concise email, even though they belong to a team
114+that gets verbose email.
115
116 >>> print_notification(collated_messages['verboseteam@example.com'][0])
117 To: verboseteam@example.com
118@@ -1003,7 +1007,6 @@
119 <BLANKLINE>
120 Title:
121 In the beginning...
122- <BLANKLINE>
123 ----------------------------------------------------------------------
124
125 Whereas Verbose Person does get the description and task status:
126@@ -1034,7 +1037,6 @@
127 <BLANKLINE>
128 To unsubscribe from this bug, go to:
129 http://bugs.launchpad.dev/.../+bug/.../+subscribe
130- <BLANKLINE>
131 ----------------------------------------------------------------------
132
133 And Concise Team Person does too, even though his team doesn't want them:
134@@ -1062,7 +1064,6 @@
135 This is a long description of the bug, which
136 will be automatically wrapped by the BugNotification
137 machinery. Ain't technology great?
138- <BLANKLINE>
139 ----------------------------------------------------------------------
140
141 It's important to note that the bug title and description are wrapped
142@@ -1078,19 +1079,17 @@
143 ...
144 'Bug description:',
145 ' This is a long description of the bug, which will be automatically',
146- " wrapped by the BugNotification machinery. Ain't technology great?",
147- ...
148+ " wrapped by the BugNotification machinery. Ain't technology great?"]
149
150 The title is also wrapped and indented in normal notifications.
151
152 >>> message = collated_messages['verboseteam@example.com'][0]
153 >>> payload = message.get_payload(decode=True)
154- >>> print payload.split('\n')
155+ >>> print payload.strip().split('\n')
156 [...
157 'Title:',
158 ' In the beginning, the universe was created. This has made a lot of',
159- ' people very angry and has been widely regarded as a bad move',
160- '']
161+ ' people very angry and has been widely regarded as a bad move']
162
163 Self-Generated Bug Notifications
164 --------------------------------
165@@ -1388,7 +1387,6 @@
166 You received this bug notification because you are subscribed to
167 mozilla-firefox in ubuntu.
168 ...
169- <BLANKLINE>
170 ----------------------------------------------------------------------
171 To: marilize@hbd.com
172 From: Sample Person <...@bugs.launchpad.net>
173@@ -1406,7 +1404,6 @@
174 <BLANKLINE>
175 Title:
176 Firefox does not support SVG
177- <BLANKLINE>
178 ----------------------------------------------------------------------
179 To: mark@example.com
180 ...
181
182=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
183--- lib/lp/bugs/scripts/bugnotification.py 2011-02-04 16:23:08 +0000
184+++ lib/lp/bugs/scripts/bugnotification.py 2011-02-16 14:15:40 +0000
185@@ -151,7 +151,7 @@
186 else:
187 email_template = 'bug-notification.txt'
188
189- body = get_email_template(email_template) % body_data
190+ body = (get_email_template(email_template) % body_data).strip()
191 msg = bug_notification_builder.build(
192 from_address, address, body, subject, email_date,
193 rationale, references, msgid)