Merge lp:~stevenk/launchpad/unmute-tooltip into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16803
Proposed branch: lp:~stevenk/launchpad/unmute-tooltip
Merge into: lp:launchpad
Diff against target: 55 lines (+9/-4)
2 files modified
lib/lp/bugs/browser/bug.py (+5/-4)
lib/lp/bugs/javascript/bug_subscription_portlet.js (+4/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/unmute-tooltip
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+190857@code.launchpad.net

Commit message

Display the correct tooltip when muting or unmuting a bug subscription.

Description of the change

Fix the tooltip when muting or unmuting a bug subscription. I am unhappy that the text is duplicated in the python and the JS, but I can not think of a clean way to remove the duplication.

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/bugs/browser/bug.py'
2--- lib/lp/bugs/browser/bug.py 2013-04-11 04:54:27 +0000
3+++ lib/lp/bugs/browser/bug.py 2013-10-14 05:34:57 +0000
4@@ -305,14 +305,15 @@
5 if self.context.bug.isMuted(user):
6 text = "Unmute bug mail"
7 icon = 'unmute'
8+ summary = (
9+ 'Unmute this bug so that you will receive emails about it.')
10 else:
11 text = "Mute bug mail"
12 icon = 'mute'
13+ summary = (
14+ 'Mute this bug so that you will not receive emails about it.')
15
16- return Link(
17- '+mute', text, icon=icon, summary=(
18- "Mute this bug so that you will not receive emails "
19- "about it."))
20+ return Link('+mute', text, icon=icon, summary=summary)
21
22 def nominate(self):
23 """Return the 'Target/Nominate for series' Link."""
24
25=== modified file 'lib/lp/bugs/javascript/bug_subscription_portlet.js'
26--- lib/lp/bugs/javascript/bug_subscription_portlet.js 2012-09-11 14:30:45 +0000
27+++ lib/lp/bugs/javascript/bug_subscription_portlet.js 2013-10-14 05:34:57 +0000
28@@ -138,16 +138,19 @@
29 }
30 var is_muted = link.hasClass(MUTED_CLASS);
31 var method_name, current_class, destination_class, destination_text;
32+ var destination_title;
33 if (is_muted) {
34 method_name = 'unmute';
35 current_class = MUTED_CLASS;
36 destination_class = UNMUTED_CLASS;
37 destination_text = 'Mute bug mail';
38+ destination_title = 'Mute this bug so that you will not receive emails about it.';
39 } else {
40 method_name = 'mute';
41 current_class = UNMUTED_CLASS;
42 destination_class = MUTED_CLASS;
43 destination_text = 'Unmute bug mail';
44+ destination_title = 'Unmute this bug so that you will receive emails about it.';
45 }
46 link.replaceClass(current_class, 'spinner');
47 var handler = new Y.lp.client.ErrorHandler();
48@@ -162,6 +165,7 @@
49 success: function(response) {
50 link.replaceClass('spinner', destination_class);
51 link.set('text', destination_text);
52+ link.set('title', destination_title);
53 update_subscription_status();
54 Y.lp.anim.green_flash(
55 { node: link.get('parentNode') }).run();