Merge lp:~deryck/launchpad/unsubscribe-note-in-email into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Deryck Hodge
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~deryck/launchpad/unsubscribe-note-in-email
Merge into: lp:launchpad
Diff against target: 50 lines (+17/-0)
3 files modified
lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt (+2/-0)
lib/lp/bugs/doc/bugnotification-sending.txt (+3/-0)
lib/lp/bugs/scripts/bugnotification.py (+12/-0)
To merge this branch: bzr merge lp:~deryck/launchpad/unsubscribe-note-in-email
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Review via email: mp+14958@code.launchpad.net

Commit message

Add a message to bug mail to offer an unsubscribe link for direct subscribers.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

This is a branch to add an "to unsubscribe from this bug, go to URL"
link to bug mail. This only happens currently for direct subscribers of
bugs or duplicate bugs. So it's just a first step, but it will help in
the common case of individuals being subscribed unknowingly.

I've claimed the nearly ancient (in Internet years anyway) bug 48863 as
being the bug for this feature.

To test:

./bin/test -vv -t bugnotification-sending.txt

 reviewer intellectronica

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/bugs/doc/bugnotification-sending.txt
  lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt
  lib/lp/bugs/scripts/bugnotification.py

Revision history for this message
Eleanor Berger (intellectronica) wrote :

as we discussed irl, this solution is awesome for solving an acute problem right now, but is quite hackish, so we're going to add an XXX referencing a bug for doing this in a more structured way, during the phase when we figure out the rationale for the email. also, the name of the unsubscribe_url variable is slightly misleading, since the value it holds isn't a URL. Hopefully this will make life easier for many frustrated users :)

review: Approve (code)

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-verbose.txt'
--- lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt 2008-01-15 00:51:07 +0000
+++ lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt 2009-11-17 17:35:22 +0000
@@ -9,3 +9,5 @@
99
10Bug description:10Bug description:
11%(bug_description)s11%(bug_description)s
12
13%(unsubscribe_notice)s
1214
=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
--- lib/lp/bugs/doc/bugnotification-sending.txt 2009-08-13 19:03:36 +0000
+++ lib/lp/bugs/doc/bugnotification-sending.txt 2009-11-17 17:35:22 +0000
@@ -1406,6 +1406,9 @@
1406 Bug description:1406 Bug description:
1407 desc1407 desc
1408 <BLANKLINE>1408 <BLANKLINE>
1409 To unsubscribe from this bug, go to:
1410 http://bugs.launchpad.dev/product-name4/+bug/.../+subscribe
1411 <BLANKLINE>
1409 ----------------------------------------------------------------------1412 ----------------------------------------------------------------------
14101413
1411And Concise Team Person does too, even though his team doesn't want them: 1414And Concise Team Person does too, even though his team doesn't want them:
14121415
=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
--- lib/lp/bugs/scripts/bugnotification.py 2009-07-23 14:52:33 +0000
+++ lib/lp/bugs/scripts/bugnotification.py 2009-11-17 17:35:22 +0000
@@ -118,10 +118,22 @@
118 reason = recipient.reason_body118 reason = recipient.reason_body
119 rationale = recipient.reason_header119 rationale = recipient.reason_header
120120
121 # XXX deryck 2009-11-17 Bug #484319
122 # This should be refactored to add a link inside the
123 # code where we build `reason`. However, this will
124 # require some extra work, and this small change now
125 # will ease pain for a lot of unhappy users.
126 if 'direct subscriber' in reason and 'member of' not in reason:
127 unsubscribe_notice = ('To unsubscribe from this bug, go to:\n'
128 '%s/+subscribe' % canonical_url(bug.bugtasks[0]))
129 else:
130 unsubscribe_notice = ''
131
121 body_data = {132 body_data = {
122 'content': mail_wrapper.format(content),133 'content': mail_wrapper.format(content),
123 'bug_title': bug.title,134 'bug_title': bug.title,
124 'bug_url': canonical_url(bug),135 'bug_url': canonical_url(bug),
136 'unsubscribe_notice': unsubscribe_notice,
125 'notification_rationale': mail_wrapper.format(reason)}137 'notification_rationale': mail_wrapper.format(reason)}
126138
127 # If the person we're sending to receives verbose notifications139 # If the person we're sending to receives verbose notifications