Merge lp:~benji/launchpad/bug-753152-this-time-for-sure into lp:launchpad/db-devel

Proposed by Benji York
Status: Merged
Approved by: Gary Poster
Approved revision: no longer in the source branch.
Merged at revision: 10434
Proposed branch: lp:~benji/launchpad/bug-753152-this-time-for-sure
Merge into: lp:launchpad/db-devel
Diff against target: 259 lines (+131/-30)
3 files modified
lib/lp/bugs/help/structural-subscription-mute.html (+26/-0)
lib/lp/registry/javascript/structural-subscription.js (+36/-21)
lib/lp/registry/javascript/tests/test_structural_subscription.js (+69/-9)
To merge this branch: bzr merge lp:~benji/launchpad/bug-753152-this-time-for-sure
Reviewer Review Type Date Requested Status
Gary Poster (community) Approve
Review via email: mp+57672@code.launchpad.net

Commit message

[r=gary][bug=753152] add help to subscription delivery enable/disable link

Description of the change

This branch (really) addresses bug 753152 by adding a help link explaining what
enable/disable link does, and more importantly what it does not.

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

Approved with text revisions we discussed on call.

Also approved with upcoming lint.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'lib/lp/bugs/help/structural-subscription-mute.html'
2--- lib/lp/bugs/help/structural-subscription-mute.html 1970-01-01 00:00:00 +0000
3+++ lib/lp/bugs/help/structural-subscription-mute.html 2011-04-14 14:05:57 +0000
4@@ -0,0 +1,26 @@
5+<html>
6+ <head>
7+ <title>What happens when I stop delivery?</title>
8+ <link rel="stylesheet" type="text/css"
9+ href="/+icing/yui/cssreset/reset.css" />
10+ <link rel="stylesheet" type="text/css"
11+ href="/+icing/yui/cssfonts/fonts.css" />
12+ <link rel="stylesheet" type="text/css"
13+ href="/+icing/yui/cssbase/base.css" />
14+ </head>
15+ <body>
16+ <h1>What happens when I stop delivery?</h1>
17+
18+ <p>
19+ Sometimes you will have bug subscriptions via a team and you no longer
20+ want to receive the emails. If so, you can disable the delivery of the
21+ messages to yourself without affecting the other team members.
22+ </p>
23+ <p>
24+ However, if a team delivers its bug messages via a mailing list or some
25+ other preferred email, disabling email delivery will not be honored
26+ because doing so would prevent the other team members from receiving the
27+ notifications.
28+ </p>
29+ </body>
30+</html>
31
32=== modified file 'lib/lp/registry/javascript/structural-subscription.js'
33--- lib/lp/registry/javascript/structural-subscription.js 2011-04-12 08:08:42 +0000
34+++ lib/lp/registry/javascript/structural-subscription.js 2011-04-14 14:05:57 +0000
35@@ -1148,7 +1148,7 @@
36 } else {
37 return MUTE_ICON_CLASS;
38 }
39- }
40+ };
41 error_handler.showError = function(error_msg) {
42 Y.lp.app.errors.display_error(mute_node, error_msg);
43 };
44@@ -1234,12 +1234,12 @@
45 var label = node.one('em.mute-label');
46 var description = node.one('.filter-description');
47 if (muted) {
48- control.set('text', 'Receive emails from this subscription');
49+ control.set('text', 'Send my emails for this subscription');
50 control.replaceClass(MUTE_ICON_CLASS, UNMUTE_ICON_CLASS);
51 label.setStyle('display', null);
52 description.setStyle('color', '#bbb');
53 } else {
54- control.set('text', 'Do not receive emails from this subscription');
55+ control.set('text', 'Stop my emails from this subscription');
56 control.replaceClass(UNMUTE_ICON_CLASS, MUTE_ICON_CLASS);
57 label.setStyle('display', 'none');
58 description.setStyle('color', null);
59@@ -1268,32 +1268,47 @@
60 var can_edit = (!filter_info.subscriber_is_team ||
61 filter_info.user_is_team_admin);
62
63- // Whitespace is stripped from the left and right of the string
64- // when you make a node, so we have to build the string with the
65- // intermediate whitespace and then create the node at the end.
66- var control_template = '';
67+ var control = filter_node.appendChild(
68+ Y.Node.create('<span style="float: right"></span>'));
69
70 if (filter_info.can_mute) {
71- control_template += (
72- '<a href="#" class="sprite js-action mute-subscription"></a>');
73- if (can_edit) {
74- control_template += ' or ';
75- }
76+ var link = control.appendChild(Y.Node.create(
77+ '<a href="#" class="sprite js-action mute-subscription"></a>'));
78+ var help = control.appendChild(Y.Node.create(
79+ '<a target="help" class="sprite maybe mute-help"'+
80+ ' style="visibility: hidden;"'+
81+ ' href="/+help/structural-subscription-mute.html">'+
82+ ' <span class="invisible-link">Delivery help</span>'+
83+ '</a>'));
84+ // We store a reference to the timeout that will hide the help link so
85+ // we can cancel it if needed.
86+ var hide_help_timeout;
87+ var show_help = function () {
88+ help.setStyle('visibility', 'visible');
89+ // Every time we trigger the display of the help link we need to
90+ // cancel any pending hiding of the help link so it doesn't
91+ // dissapear on us. If there isn't one pending, this is a NOP.
92+ clearTimeout(hide_help_timeout);
93+ };
94+ var hide_help = function () {
95+ hide_help_timeout = setTimeout(function () {
96+ help.setStyle('visibility', 'hidden');
97+ }, 2000);
98+ };
99+ link.on('hover', show_help, hide_help);
100+ help.on('hover', show_help, hide_help);
101 }
102 if (can_edit) {
103 // User can edit the subscription.
104- control_template += (
105- '<a href="#" class="sprite modify edit js-action '+
106- ' edit-subscription">Edit this subscription</a> or '+
107- '<a href="#" class="sprite modify remove js-action '+
108- ' delete-subscription">Unsubscribe</a>');
109+ control.append(Y.Node.create(
110+ '<a href="#" style="margin-right: 2em;"'+
111+ ' class="sprite modify edit js-action edit-subscription">'+
112+ ' Edit this subscription</a>'+
113+ '<a href="#" class="sprite modify remove js-action '+
114+ ' delete-subscription">Unsubscribe</a>'));
115 }
116
117 filter_node.appendChild(
118- Y.Node.create(
119- '<span style="float: right"></span>'))
120- .appendChild(Y.Node.create(control_template));
121- filter_node.appendChild(
122 Y.Node.create('<div style="padding-left: 1em" '+
123 'class="filter-description"></div>'));
124
125
126=== modified file 'lib/lp/registry/javascript/tests/test_structural_subscription.js'
127--- lib/lp/registry/javascript/tests/test_structural_subscription.js 2011-04-12 08:08:42 +0000
128+++ lib/lp/registry/javascript/tests/test_structural_subscription.js 2011-04-14 14:05:57 +0000
129@@ -633,7 +633,7 @@
130 Assert.isTrue(submit_button.hasClass('spinner'));
131 Assert.isFalse(submit_button.hasClass('lazr-pos'));
132 // Now we resume the call to trigger the failure.
133- this.configuration.lp_client.named_post.resume()
134+ this.configuration.lp_client.named_post.resume();
135
136 Assert.isTrue(submit_button.hasClass('lazr-pos'));
137 Assert.isFalse(submit_button.hasClass('spinner'));
138@@ -1366,11 +1366,11 @@
139 subscriber_is_team: true,
140 subscriber_url: 'http://example.com/subscriber',
141 subscriber_title: 'Thidwick',
142- user_is_team_admin: false,
143+ user_is_team_admin: false
144 }
145 ]
146 }
147- ]
148+ ];
149 },
150
151 tearDown: function() {
152@@ -1420,7 +1420,7 @@
153 var filter_node = listing.one('#subscription-filter-0');
154 var mute_label_node = filter_node.one('.mute-label');
155 var mute_link = filter_node.one('a.mute-subscription');
156- this.lp_client.named_post.args = []
157+ this.lp_client.named_post.args = [];
158 mute_link.simulate('click');
159 Assert.areEqual(this.lp_client.received[0][0], 'named_post');
160 Assert.areEqual(
161@@ -1442,7 +1442,7 @@
162 var filter_node = listing.one('#subscription-filter-0');
163 var mute_label_node = filter_node.one('.mute-label');
164 var mute_link = filter_node.one('a.mute-subscription');
165- this.lp_client.named_post.args = []
166+ this.lp_client.named_post.args = [];
167 mute_link.simulate('click');
168 Assert.areEqual(this.lp_client.received[0][0], 'named_post');
169 Assert.areEqual(
170@@ -1463,8 +1463,8 @@
171 var listing = this.test_node.one(subscription_listing_id);
172 var filter_node = listing.one('#subscription-filter-0');
173 var mute_link = filter_node.one('a.mute-subscription');
174- this.lp_client.named_post.args = []
175- this.lp_client.named_post.halt = true
176+ this.lp_client.named_post.args = [];
177+ this.lp_client.named_post.halt = true;
178 mute_link.simulate('click');
179 Assert.isTrue(mute_link.hasClass('spinner'));
180 Assert.isFalse(mute_link.hasClass('no'));
181@@ -1482,9 +1482,9 @@
182 var listing = this.test_node.one(subscription_listing_id);
183 var filter_node = listing.one('#subscription-filter-0');
184 var mute_link = filter_node.one('a.mute-subscription');
185- this.lp_client.named_post.fail = true
186+ this.lp_client.named_post.fail = true;
187 this.lp_client.named_post.args = [true, true];
188- this.lp_client.named_post.halt = true
189+ this.lp_client.named_post.halt = true;
190 mute_link.simulate('click');
191 Assert.isTrue(mute_link.hasClass('spinner'));
192 Assert.isFalse(mute_link.hasClass('no'));
193@@ -1495,6 +1495,66 @@
194
195 }));
196
197+ suite.add(new Y.Test.Case({
198+ name: 'Structural Subscription: enable/disable help link',
199+
200+ _should: {error: {}},
201+
202+ setUp: function() {
203+ this.original_lp = monkeypatch_LP();
204+
205+ LP.cache.subscription_info = [{
206+ target_url: 'http://example.com',
207+ target_title:'Example project',
208+ filters: [{
209+ filter: {
210+ description: 'DESCRIPTION',
211+ statuses: [],
212+ importances: [],
213+ tags: [],
214+ find_all_tags: true,
215+ bug_notification_level: 'Discussion',
216+ self_link: 'http://example.com/a_filter'
217+ },
218+ can_mute: true,
219+ is_muted: false,
220+ subscriber_is_team: true,
221+ subscriber_url: 'http://example.com/subscriber',
222+ subscriber_title: 'Thidwick',
223+ user_is_team_admin: false
224+ }]
225+ }];
226+
227+
228+ this.configuration = {
229+ content_box: content_box_id,
230+ lp_client: make_lp_client_stub()
231+ };
232+ this.content_node = create_test_node(true);
233+ Y.one('body').appendChild(this.content_node);
234+ },
235+
236+ tearDown: function() {
237+ window.LP = this.original_lp;
238+ remove_test_node();
239+ delete this.content_node;
240+ },
241+
242+ test_help_link_hover: function() {
243+ module.setup_bug_subscriptions(this.configuration);
244+
245+ // Initially the help link is not visible.
246+ var help = Y.one('a.mute-help');
247+ Assert.isFalse(help.getStyle('visibility') === 'visible');
248+
249+ // If we hover over the enable/disable (mute) link the help link
250+ // becomes visible.
251+ Y.one('a.mute-subscription').simulate('mouseover');
252+ Assert.areEqual('visible', help.getStyle('visibility'));
253+ }
254+
255+ }));
256+
257 // Lock, stock, and two smoking barrels.
258 var handle_complete = function(data) {
259 var status_node = Y.Node.create(

Subscribers

People subscribed via source and target branches

to status/vote changes: