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
=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification.txt'
--- lib/canonical/launchpad/emailtemplates/bug-notification.txt 2011-01-06 14:43:46 +0000
+++ lib/canonical/launchpad/emailtemplates/bug-notification.txt 2011-02-16 14:15:40 +0000
@@ -6,3 +6,5 @@
66
7Title:7Title:
8%(bug_title)s8%(bug_title)s
9
10%(unsubscribe_notice)s
911
=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
--- lib/lp/bugs/doc/bugnotification-sending.txt 2011-02-08 14:34:55 +0000
+++ lib/lp/bugs/doc/bugnotification-sending.txt 2011-02-16 14:15:40 +0000
@@ -80,7 +80,6 @@
80 <BLANKLINE>80 <BLANKLINE>
81 Title:81 Title:
82 Firefox does not support SVG82 Firefox does not support SVG
83 <BLANKLINE>
84 ----------------------------------------------------------------------83 ----------------------------------------------------------------------
85 To: mark@example.com84 To: mark@example.com
86 From: Sample Person <1@bugs.launchpad.net>85 From: Sample Person <1@bugs.launchpad.net>
@@ -95,7 +94,6 @@
95 <BLANKLINE>94 <BLANKLINE>
96 Title:95 Title:
97 Firefox does not support SVG96 Firefox does not support SVG
98 <BLANKLINE>
99 ----------------------------------------------------------------------97 ----------------------------------------------------------------------
100 To: support@ubuntu.com98 To: support@ubuntu.com
101 From: Sample Person <1@bugs.launchpad.net>99 From: Sample Person <1@bugs.launchpad.net>
@@ -111,7 +109,6 @@
111 <BLANKLINE>109 <BLANKLINE>
112 Title:110 Title:
113 Firefox does not support SVG111 Firefox does not support SVG
114 <BLANKLINE>
115 ----------------------------------------------------------------------112 ----------------------------------------------------------------------
116 To: test@canonical.com113 To: test@canonical.com
117 From: Sample Person <1@bugs.launchpad.net>114 From: Sample Person <1@bugs.launchpad.net>
@@ -128,6 +125,7 @@
128 Title:125 Title:
129 Firefox does not support SVG126 Firefox does not support SVG
130 <BLANKLINE>127 <BLANKLINE>
128 ...
131 ----------------------------------------------------------------------129 ----------------------------------------------------------------------
132130
133You can see that the message above contains the bug's initial comment's131You can see that the message above contains the bug's initial comment's
@@ -249,7 +247,6 @@
249 <BLANKLINE>247 <BLANKLINE>
250 Title:248 Title:
251 Firefox does not support SVG249 Firefox does not support SVG
252 <BLANKLINE>
253 ----------------------------------------------------------------------250 ----------------------------------------------------------------------
254 To: test@canonical.com251 To: test@canonical.com
255 ...252 ...
@@ -343,7 +340,7 @@
343 'http://bugs.launchpad.dev/bugs/1',340 'http://bugs.launchpad.dev/bugs/1',
344 '',341 '',
345 'Title:',342 'Title:',
346 ' Firefox does not support SVG']343 ' Firefox does not support SVG'...]
347344
348 >>> flush_notifications()345 >>> flush_notifications()
349346
@@ -429,14 +426,13 @@
429 <BLANKLINE>426 <BLANKLINE>
430 a comment.427 a comment.
431 <BLANKLINE>428 <BLANKLINE>
432 --429 --
433 You received this bug notification because you are a member of Ubuntu430 You received this bug notification because you are a member of Ubuntu
434 Team, which is the registrant for Ubuntu.431 Team, which is the registrant for Ubuntu.
435 http://bugs.launchpad.dev/bugs/16432 http://bugs.launchpad.dev/bugs/16
436 <BLANKLINE>433 <BLANKLINE>
437 Title:434 Title:
438 new bug435 new bug
439 <BLANKLINE>
440 ----------------------------------------------------------------------436 ----------------------------------------------------------------------
441 To: test@canonical.com437 To: test@canonical.com
442 From: Sample Person <16@bugs.launchpad.net>438 From: Sample Person <16@bugs.launchpad.net>
@@ -448,7 +444,7 @@
448 <BLANKLINE>444 <BLANKLINE>
449 a comment.445 a comment.
450 <BLANKLINE>446 <BLANKLINE>
451 --447 --
452 You received this bug notification because you are a direct subscriber448 You received this bug notification because you are a direct subscriber
453 of the bug.449 of the bug.
454 http://bugs.launchpad.dev/bugs/16450 http://bugs.launchpad.dev/bugs/16
@@ -456,6 +452,8 @@
456 Title:452 Title:
457 new bug453 new bug
458 <BLANKLINE>454 <BLANKLINE>
455 To unsubscribe from this bug, go to:
456 http://bugs.launchpad.dev/ubuntu/+bug/16/+subscribe
459 ----------------------------------------------------------------------457 ----------------------------------------------------------------------
460458
461 >>> flush_notifications()459 >>> flush_notifications()
@@ -982,11 +980,17 @@
982 <BLANKLINE>980 <BLANKLINE>
983 Title:981 Title:
984 In the beginning...982 In the beginning...
985 <BLANKLINE>
986 ----------------------------------------------------------------------983 ----------------------------------------------------------------------
987984
988Neither does Verbose Team Person - while the team wants verbose emails,985However, Concise Person does get an unsubscribe link.
989he wants concise ones.986
987 >>> print_notification(collated_messages['concise@example.com'][0])
988 To: concise@example.com
989 ...
990 To unsubscribe from this bug, go to:...
991
992Verbose Team Person gets a concise email, even though they belong to a team
993that gets verbose email.
990994
991 >>> print_notification(collated_messages['verboseteam@example.com'][0])995 >>> print_notification(collated_messages['verboseteam@example.com'][0])
992 To: verboseteam@example.com996 To: verboseteam@example.com
@@ -1003,7 +1007,6 @@
1003 <BLANKLINE>1007 <BLANKLINE>
1004 Title:1008 Title:
1005 In the beginning...1009 In the beginning...
1006 <BLANKLINE>
1007 ----------------------------------------------------------------------1010 ----------------------------------------------------------------------
10081011
1009Whereas Verbose Person does get the description and task status:1012Whereas Verbose Person does get the description and task status:
@@ -1034,7 +1037,6 @@
1034 <BLANKLINE>1037 <BLANKLINE>
1035 To unsubscribe from this bug, go to:1038 To unsubscribe from this bug, go to:
1036 http://bugs.launchpad.dev/.../+bug/.../+subscribe1039 http://bugs.launchpad.dev/.../+bug/.../+subscribe
1037 <BLANKLINE>
1038 ----------------------------------------------------------------------1040 ----------------------------------------------------------------------
10391041
1040And Concise Team Person does too, even though his team doesn't want them:1042And Concise Team Person does too, even though his team doesn't want them:
@@ -1062,7 +1064,6 @@
1062 This is a long description of the bug, which1064 This is a long description of the bug, which
1063 will be automatically wrapped by the BugNotification1065 will be automatically wrapped by the BugNotification
1064 machinery. Ain't technology great?1066 machinery. Ain't technology great?
1065 <BLANKLINE>
1066 ----------------------------------------------------------------------1067 ----------------------------------------------------------------------
10671068
1068It's important to note that the bug title and description are wrapped1069It's important to note that the bug title and description are wrapped
@@ -1078,19 +1079,17 @@
1078 ...1079 ...
1079 'Bug description:',1080 'Bug description:',
1080 ' This is a long description of the bug, which will be automatically',1081 ' This is a long description of the bug, which will be automatically',
1081 " wrapped by the BugNotification machinery. Ain't technology great?",1082 " wrapped by the BugNotification machinery. Ain't technology great?"]
1082 ...
10831083
1084The title is also wrapped and indented in normal notifications.1084The title is also wrapped and indented in normal notifications.
10851085
1086 >>> message = collated_messages['verboseteam@example.com'][0]1086 >>> message = collated_messages['verboseteam@example.com'][0]
1087 >>> payload = message.get_payload(decode=True)1087 >>> payload = message.get_payload(decode=True)
1088 >>> print payload.split('\n')1088 >>> print payload.strip().split('\n')
1089 [...1089 [...
1090 'Title:',1090 'Title:',
1091 ' In the beginning, the universe was created. This has made a lot of',1091 ' In the beginning, the universe was created. This has made a lot of',
1092 ' people very angry and has been widely regarded as a bad move',1092 ' people very angry and has been widely regarded as a bad move']
1093 '']
10941093
1095Self-Generated Bug Notifications1094Self-Generated Bug Notifications
1096--------------------------------1095--------------------------------
@@ -1388,7 +1387,6 @@
1388 You received this bug notification because you are subscribed to1387 You received this bug notification because you are subscribed to
1389 mozilla-firefox in ubuntu.1388 mozilla-firefox in ubuntu.
1390 ...1389 ...
1391 <BLANKLINE>
1392 ----------------------------------------------------------------------1390 ----------------------------------------------------------------------
1393 To: marilize@hbd.com1391 To: marilize@hbd.com
1394 From: Sample Person <...@bugs.launchpad.net>1392 From: Sample Person <...@bugs.launchpad.net>
@@ -1406,7 +1404,6 @@
1406 <BLANKLINE>1404 <BLANKLINE>
1407 Title:1405 Title:
1408 Firefox does not support SVG1406 Firefox does not support SVG
1409 <BLANKLINE>
1410 ----------------------------------------------------------------------1407 ----------------------------------------------------------------------
1411 To: mark@example.com1408 To: mark@example.com
1412 ...1409 ...
14131410
=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
--- lib/lp/bugs/scripts/bugnotification.py 2011-02-04 16:23:08 +0000
+++ lib/lp/bugs/scripts/bugnotification.py 2011-02-16 14:15:40 +0000
@@ -151,7 +151,7 @@
151 else:151 else:
152 email_template = 'bug-notification.txt'152 email_template = 'bug-notification.txt'
153153
154 body = get_email_template(email_template) % body_data154 body = (get_email_template(email_template) % body_data).strip()
155 msg = bug_notification_builder.build(155 msg = bug_notification_builder.build(
156 from_address, address, body, subject, email_date,156 from_address, address, body, subject, email_date,
157 rationale, references, msgid)157 rationale, references, msgid)