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
1=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt'
2--- lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt 2008-01-15 00:51:07 +0000
3+++ lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt 2009-11-17 17:35:22 +0000
4@@ -9,3 +9,5 @@
5
6 Bug description:
7 %(bug_description)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 2009-08-13 19:03:36 +0000
13+++ lib/lp/bugs/doc/bugnotification-sending.txt 2009-11-17 17:35:22 +0000
14@@ -1406,6 +1406,9 @@
15 Bug description:
16 desc
17 <BLANKLINE>
18+ To unsubscribe from this bug, go to:
19+ http://bugs.launchpad.dev/product-name4/+bug/.../+subscribe
20+ <BLANKLINE>
21 ----------------------------------------------------------------------
22
23 And Concise Team Person does too, even though his team doesn't want them:
24
25=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
26--- lib/lp/bugs/scripts/bugnotification.py 2009-07-23 14:52:33 +0000
27+++ lib/lp/bugs/scripts/bugnotification.py 2009-11-17 17:35:22 +0000
28@@ -118,10 +118,22 @@
29 reason = recipient.reason_body
30 rationale = recipient.reason_header
31
32+ # XXX deryck 2009-11-17 Bug #484319
33+ # This should be refactored to add a link inside the
34+ # code where we build `reason`. However, this will
35+ # require some extra work, and this small change now
36+ # will ease pain for a lot of unhappy users.
37+ if 'direct subscriber' in reason and 'member of' not in reason:
38+ unsubscribe_notice = ('To unsubscribe from this bug, go to:\n'
39+ '%s/+subscribe' % canonical_url(bug.bugtasks[0]))
40+ else:
41+ unsubscribe_notice = ''
42+
43 body_data = {
44 'content': mail_wrapper.format(content),
45 'bug_title': bug.title,
46 'bug_url': canonical_url(bug),
47+ 'unsubscribe_notice': unsubscribe_notice,
48 'notification_rationale': mail_wrapper.format(reason)}
49
50 # If the person we're sending to receives verbose notifications