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

Proposed by Benji York
Status: Merged
Approved by: Benji York
Approved revision: no longer in the source branch.
Merged at revision: 12828
Proposed branch: lp:~benji/launchpad/bug-753152
Merge into: lp:launchpad
Diff against target: 224 lines (+72/-21)
4 files modified
lib/lp/bugs/browser/tests/test_bug_context_menu.py (+18/-0)
lib/lp/bugs/help/subscription-mute.html (+30/-0)
lib/lp/bugs/javascript/bugtask_index_portlets.js (+17/-17)
lib/lp/bugs/templates/bug-portlet-subscribers.pt (+7/-4)
To merge this branch: bzr merge lp:~benji/launchpad/bug-753152
Reviewer Review Type Date Requested Status
Gary Poster (community) Approve
Review via email: mp+57553@code.launchpad.net

Commit message

[r=gary][bug=753152][no-qa] add a help link to the mute/unmute link

Description of the change

This branch addresses bug 753152 by adding a help link explaining what
mute/unmute does.

Lots of lint was fixed in bugtask_index_portlets.js. The only
substantive change made to that file was this:

     function setup_portlet(transactionid, response, args) {
         hide_spinner();
- var portlet = Y.one('#portlet-subscribers');
- portlet.set('innerHTML',
- portlet.get('innerHTML') + response.responseText);
+ Y.one('#portlet-subscribers')
+ .appendChild(Y.Node.create(response.responseText));

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

This is a good fix. As we discussed, it wasn't actually what I intended to bring up in bug 753152, but this direct subscription muting is a parallel problem, and worthy of explaining. The JS lint and innerHTML changes look nice too.

Approved, with the following changes:

 - Move lib/lp/bugs/help/structural-subscription-mute.html to lib/lp/bugs/help/subscription-mute.html or similar.
 - fix typo "abotu"
 - land as incremental fix for the bug (or new bug as you wish) and then make another branch to fix the structural subscription version of the bug.

Thank you,

Gary

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/tests/test_bug_context_menu.py'
2--- lib/lp/bugs/browser/tests/test_bug_context_menu.py 2011-03-09 14:07:35 +0000
3+++ lib/lp/bugs/browser/tests/test_bug_context_menu.py 2011-04-13 18:44:47 +0000
4@@ -8,16 +8,20 @@
5 from zope.component import getUtility
6
7 from canonical.launchpad.webapp.interfaces import IOpenLaunchBag
8+from canonical.launchpad.webapp.servers import LaunchpadTestRequest
9 from canonical.testing.layers import DatabaseFunctionalLayer
10
11 from lp.bugs.browser.bug import BugContextMenu
12 from lp.bugs.enum import BugNotificationLevel
13+from lp.services.features import get_relevant_feature_controller
14 from lp.testing import (
15 feature_flags,
16 person_logged_in,
17 set_feature_flag,
18 TestCaseWithFactory,
19 )
20+from lp.testing.views import create_initialized_view
21+
22
23 class TestBugContextMenu(TestCaseWithFactory):
24
25@@ -65,3 +69,17 @@
26 person, person, level=BugNotificationLevel.NOTHING)
27 link = self.context_menu.mute_subscription()
28 self.assertEqual("Unmute bug mail", link.text)
29+
30+ def test_mute_help_available(self):
31+ # There is a help link available next to the mute/unmute button.
32+ person = self.factory.makePerson()
33+ with feature_flags():
34+ with person_logged_in(person):
35+ self.bug.subscribe(
36+ person, person, level=BugNotificationLevel.NOTHING)
37+ request = LaunchpadTestRequest()
38+ request.features = get_relevant_feature_controller()
39+ view = create_initialized_view(
40+ self.bug, name="+portlet-subscribers", request=request)
41+ html = view.render()
42+ self.assertTrue('class="sprite maybe mute-help"' in html)
43
44=== added file 'lib/lp/bugs/help/subscription-mute.html'
45--- lib/lp/bugs/help/subscription-mute.html 1970-01-01 00:00:00 +0000
46+++ lib/lp/bugs/help/subscription-mute.html 2011-04-13 18:44:47 +0000
47@@ -0,0 +1,30 @@
48+<html>
49+ <head>
50+ <title>What happens when I "mute" or "unmute" a bug?</title>
51+ <link rel="stylesheet" type="text/css"
52+ href="/+icing/yui/cssreset/reset.css" />
53+ <link rel="stylesheet" type="text/css"
54+ href="/+icing/yui/cssfonts/fonts.css" />
55+ <link rel="stylesheet" type="text/css"
56+ href="/+icing/yui/cssbase/base.css" />
57+ </head>
58+ <body>
59+ <h1>What happens when I "mute" a bug?</h1>
60+
61+ <p>
62+ You may have a subscription to a bug target that sends email
63+ notifications about bug activity. However, you may not be interested in
64+ a particular bug. In that case you can "mute" the bug and you will not
65+ recieve notifications about it.
66+ </p>
67+ <p>
68+ When "unmuting" a bug you are asked what kinds of messages you would
69+ like to recieve about the bug.
70+ </p>
71+ <p>
72+ If you are subscribed via a team, but the team delivers its bug messages
73+ via a mailing list or some other preferred email, the mute will not be
74+ honored because doing so would prevent the other team members from
75+ recieving the notifications.
76+ </body>
77+</html>
78
79=== modified file 'lib/lp/bugs/javascript/bugtask_index_portlets.js'
80--- lib/lp/bugs/javascript/bugtask_index_portlets.js 2011-03-24 14:13:45 +0000
81+++ lib/lp/bugs/javascript/bugtask_index_portlets.js 2011-04-13 18:44:47 +0000
82@@ -84,9 +84,8 @@
83
84 function setup_portlet(transactionid, response, args) {
85 hide_spinner();
86- var portlet = Y.one('#portlet-subscribers');
87- portlet.set('innerHTML',
88- portlet.get('innerHTML') + response.responseText);
89+ Y.one('#portlet-subscribers')
90+ .appendChild(Y.Node.create(response.responseText));
91
92 // Fire a custom portlet loaded event to notify when
93 // it's safe to setup subscriber link callbacks.
94@@ -194,7 +193,7 @@
95 };
96 lp_client.named_post(bug_repr.self_link, 'subscribe', config);
97 });
98-}
99+};
100
101 function load_subscriber_ids() {
102 function on_success(transactionid, response, args) {
103@@ -523,7 +522,7 @@
104 var is_dupe;
105 var icon_parent_div = icon_parent.get('parentNode');
106 var dupe_id = 'dupe-' + person.get('css_name');
107- if (icon_parent_div.get('id') == dupe_id) {
108+ if (icon_parent_div.get('id') === dupe_id) {
109 is_dupe = true;
110 } else {
111 is_dupe = false;
112@@ -680,8 +679,8 @@
113 subscription_overlay.show();
114 }
115 var config = {
116- on: {success: on_success, failure: on_failure},
117- }
118+ on: {success: on_success, failure: on_failure}
119+ };
120 Y.io(subscription_link_url, config);
121 }
122
123@@ -1033,7 +1032,7 @@
124 var all_subscribers = Y.all('#subscribers-links div');
125 if (all_subscribers.size() > 0) {
126 all_subscribers.each(function(sub_link) {
127- if (sub_link.getAttribute('id') != 'temp-username') {
128+ if (sub_link.getAttribute('id') !== 'temp-username') {
129 // User's displayname is found via the link's "name"
130 // attribute.
131 var sub_link_name = sub_link.one('a').getAttribute('name');
132@@ -1077,7 +1076,7 @@
133 } else if (can_be_unsubscribed) {
134 // If the user belongs in the first list, loop the list for position.
135 for (i=0; i<unsubscribables.length; i++) {
136- if (unsubscribables[i] == full_name) {
137+ if (unsubscribables[i] === full_name) {
138 if (i+1 < unsubscribables.length) {
139 return nodes_by_name[unsubscribables[i+1]];
140 // If the current link should go at the end of the first
141@@ -1092,7 +1091,7 @@
142 } else if (!can_be_unsubscribed) {
143 // If user belongs in the second list, loop the list for position.
144 for (i=0; i<not_unsubscribables.length; i++) {
145- if (not_unsubscribables[i] == full_name) {
146+ if (not_unsubscribables[i] === full_name) {
147 if (i+1 < not_unsubscribables.length) {
148 return nodes_by_name[not_unsubscribables[i+1]];
149 } else {
150@@ -1120,7 +1119,7 @@
151
152 // Strip the domain off. We just want a path.
153 var host_start = user_uri.indexOf('//');
154- if (host_start != -1) {
155+ if (host_start !== -1) {
156 var host_end = user_uri.indexOf('/', host_start+2);
157 return user_uri.substring(host_end, user_uri.length);
158 }
159@@ -1218,7 +1217,7 @@
160 form_data['field.bug_notification_level']);
161 subscribe_current_user(subscription);
162 } else if (
163- form_data['field.subscription'] == 'update-subscription') {
164+ form_data['field.subscription'] === 'update-subscription') {
165 // The user is already subscribed or is muted and wants to
166 // update their subscription.
167 setup_client_and_bug();
168@@ -1235,7 +1234,7 @@
169 }
170 lp_subscription.set(
171 'bug_notification_level',
172- form_data['field.bug_notification_level'][0])
173+ form_data['field.bug_notification_level'][0]);
174 save_config = {
175 on: {
176 success: function(e) {
177@@ -1265,11 +1264,11 @@
178 anim.run();
179 }
180 }
181- }
182+ };
183 lp_subscription.lp_save(save_config);
184 }
185 }
186- }
187+ };
188 lp_client.get(subscription_url, config);
189 } else {
190 // The user is already subscribed and wants to unsubscribe.
191@@ -1338,8 +1337,9 @@
192 on: {
193 success: function(result) {
194 var team_member = false;
195- for (var i=0; i<result.entries.length; i++) {
196- if (result.entries[i].member_link ==
197+ var i;
198+ for (i=0; i<result.entries.length; i++) {
199+ if (result.entries[i].member_link ===
200 Y.lp.client.get_absolute_uri(
201 subscription.get(
202 'subscriber').get('uri'))) {
203
204=== modified file 'lib/lp/bugs/templates/bug-portlet-subscribers.pt'
205--- lib/lp/bugs/templates/bug-portlet-subscribers.pt 2011-04-05 17:55:44 +0000
206+++ lib/lp/bugs/templates/bug-portlet-subscribers.pt 2011-04-13 18:44:47 +0000
207@@ -16,10 +16,13 @@
208 <div tal:condition="request/features/malone.advanced-structural-subscriptions.enabled"
209 tal:content="structure context_menu/editsubscriptions/render" />
210 <tal:show-mute condition="view/user_should_see_mute_link">
211- <div
212- tal:attributes="class view/current_user_mute_class"
213- tal:content="structure context_menu/mute_subscription/render" />
214- <div id="mute-unmute-spinner">Unmuting...</div>
215+ <div tal:attributes="class view/current_user_mute_class">
216+ <span tal:replace="structure context_menu/mute_subscription/render"/>
217+ <a target="help" class="sprite maybe mute-help"
218+ href="/+help/subscription-mute.html"
219+ >&nbsp;<span class="invisible-link">Mute help</span></a>
220+ <div style="float: left" id="mute-unmute-spinner">Unmuting...</div>
221+ </div>
222 </tal:show-mute>
223 </div>
224 <a id="subscribers-ids-link"