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
=== added file 'lib/lp/bugs/help/structural-subscription-mute.html'
--- lib/lp/bugs/help/structural-subscription-mute.html 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/help/structural-subscription-mute.html 2011-04-14 14:05:57 +0000
@@ -0,0 +1,26 @@
1<html>
2 <head>
3 <title>What happens when I stop delivery?</title>
4 <link rel="stylesheet" type="text/css"
5 href="/+icing/yui/cssreset/reset.css" />
6 <link rel="stylesheet" type="text/css"
7 href="/+icing/yui/cssfonts/fonts.css" />
8 <link rel="stylesheet" type="text/css"
9 href="/+icing/yui/cssbase/base.css" />
10 </head>
11 <body>
12 <h1>What happens when I stop delivery?</h1>
13
14 <p>
15 Sometimes you will have bug subscriptions via a team and you no longer
16 want to receive the emails. If so, you can disable the delivery of the
17 messages to yourself without affecting the other team members.
18 </p>
19 <p>
20 However, if a team delivers its bug messages via a mailing list or some
21 other preferred email, disabling email delivery will not be honored
22 because doing so would prevent the other team members from receiving the
23 notifications.
24 </p>
25 </body>
26</html>
027
=== modified file 'lib/lp/registry/javascript/structural-subscription.js'
--- lib/lp/registry/javascript/structural-subscription.js 2011-04-12 08:08:42 +0000
+++ lib/lp/registry/javascript/structural-subscription.js 2011-04-14 14:05:57 +0000
@@ -1148,7 +1148,7 @@
1148 } else {1148 } else {
1149 return MUTE_ICON_CLASS;1149 return MUTE_ICON_CLASS;
1150 }1150 }
1151 }1151 };
1152 error_handler.showError = function(error_msg) {1152 error_handler.showError = function(error_msg) {
1153 Y.lp.app.errors.display_error(mute_node, error_msg);1153 Y.lp.app.errors.display_error(mute_node, error_msg);
1154 };1154 };
@@ -1234,12 +1234,12 @@
1234 var label = node.one('em.mute-label');1234 var label = node.one('em.mute-label');
1235 var description = node.one('.filter-description');1235 var description = node.one('.filter-description');
1236 if (muted) {1236 if (muted) {
1237 control.set('text', 'Receive emails from this subscription');1237 control.set('text', 'Send my emails for this subscription');
1238 control.replaceClass(MUTE_ICON_CLASS, UNMUTE_ICON_CLASS);1238 control.replaceClass(MUTE_ICON_CLASS, UNMUTE_ICON_CLASS);
1239 label.setStyle('display', null);1239 label.setStyle('display', null);
1240 description.setStyle('color', '#bbb');1240 description.setStyle('color', '#bbb');
1241 } else {1241 } else {
1242 control.set('text', 'Do not receive emails from this subscription');1242 control.set('text', 'Stop my emails from this subscription');
1243 control.replaceClass(UNMUTE_ICON_CLASS, MUTE_ICON_CLASS);1243 control.replaceClass(UNMUTE_ICON_CLASS, MUTE_ICON_CLASS);
1244 label.setStyle('display', 'none');1244 label.setStyle('display', 'none');
1245 description.setStyle('color', null);1245 description.setStyle('color', null);
@@ -1268,32 +1268,47 @@
1268 var can_edit = (!filter_info.subscriber_is_team ||1268 var can_edit = (!filter_info.subscriber_is_team ||
1269 filter_info.user_is_team_admin);1269 filter_info.user_is_team_admin);
12701270
1271 // Whitespace is stripped from the left and right of the string1271 var control = filter_node.appendChild(
1272 // when you make a node, so we have to build the string with the1272 Y.Node.create('<span style="float: right"></span>'));
1273 // intermediate whitespace and then create the node at the end.
1274 var control_template = '';
12751273
1276 if (filter_info.can_mute) {1274 if (filter_info.can_mute) {
1277 control_template += (1275 var link = control.appendChild(Y.Node.create(
1278 '<a href="#" class="sprite js-action mute-subscription"></a>');1276 '<a href="#" class="sprite js-action mute-subscription"></a>'));
1279 if (can_edit) {1277 var help = control.appendChild(Y.Node.create(
1280 control_template += ' or ';1278 '<a target="help" class="sprite maybe mute-help"'+
1281 }1279 ' style="visibility: hidden;"'+
1280 ' href="/+help/structural-subscription-mute.html">'+
1281 ' <span class="invisible-link">Delivery help</span>'+
1282 '</a>'));
1283 // We store a reference to the timeout that will hide the help link so
1284 // we can cancel it if needed.
1285 var hide_help_timeout;
1286 var show_help = function () {
1287 help.setStyle('visibility', 'visible');
1288 // Every time we trigger the display of the help link we need to
1289 // cancel any pending hiding of the help link so it doesn't
1290 // dissapear on us. If there isn't one pending, this is a NOP.
1291 clearTimeout(hide_help_timeout);
1292 };
1293 var hide_help = function () {
1294 hide_help_timeout = setTimeout(function () {
1295 help.setStyle('visibility', 'hidden');
1296 }, 2000);
1297 };
1298 link.on('hover', show_help, hide_help);
1299 help.on('hover', show_help, hide_help);
1282 }1300 }
1283 if (can_edit) {1301 if (can_edit) {
1284 // User can edit the subscription.1302 // User can edit the subscription.
1285 control_template += (1303 control.append(Y.Node.create(
1286 '<a href="#" class="sprite modify edit js-action '+1304 '<a href="#" style="margin-right: 2em;"'+
1287 ' edit-subscription">Edit this subscription</a> or '+1305 ' class="sprite modify edit js-action edit-subscription">'+
1288 '<a href="#" class="sprite modify remove js-action '+1306 ' Edit this subscription</a>'+
1289 ' delete-subscription">Unsubscribe</a>');1307 '<a href="#" class="sprite modify remove js-action '+
1308 ' delete-subscription">Unsubscribe</a>'));
1290 }1309 }
12911310
1292 filter_node.appendChild(1311 filter_node.appendChild(
1293 Y.Node.create(
1294 '<span style="float: right"></span>'))
1295 .appendChild(Y.Node.create(control_template));
1296 filter_node.appendChild(
1297 Y.Node.create('<div style="padding-left: 1em" '+1312 Y.Node.create('<div style="padding-left: 1em" '+
1298 'class="filter-description"></div>'));1313 'class="filter-description"></div>'));
12991314
13001315
=== modified file 'lib/lp/registry/javascript/tests/test_structural_subscription.js'
--- lib/lp/registry/javascript/tests/test_structural_subscription.js 2011-04-12 08:08:42 +0000
+++ lib/lp/registry/javascript/tests/test_structural_subscription.js 2011-04-14 14:05:57 +0000
@@ -633,7 +633,7 @@
633 Assert.isTrue(submit_button.hasClass('spinner'));633 Assert.isTrue(submit_button.hasClass('spinner'));
634 Assert.isFalse(submit_button.hasClass('lazr-pos'));634 Assert.isFalse(submit_button.hasClass('lazr-pos'));
635 // Now we resume the call to trigger the failure.635 // Now we resume the call to trigger the failure.
636 this.configuration.lp_client.named_post.resume()636 this.configuration.lp_client.named_post.resume();
637637
638 Assert.isTrue(submit_button.hasClass('lazr-pos'));638 Assert.isTrue(submit_button.hasClass('lazr-pos'));
639 Assert.isFalse(submit_button.hasClass('spinner'));639 Assert.isFalse(submit_button.hasClass('spinner'));
@@ -1366,11 +1366,11 @@
1366 subscriber_is_team: true,1366 subscriber_is_team: true,
1367 subscriber_url: 'http://example.com/subscriber',1367 subscriber_url: 'http://example.com/subscriber',
1368 subscriber_title: 'Thidwick',1368 subscriber_title: 'Thidwick',
1369 user_is_team_admin: false,1369 user_is_team_admin: false
1370 }1370 }
1371 ]1371 ]
1372 }1372 }
1373 ]1373 ];
1374 },1374 },
13751375
1376 tearDown: function() {1376 tearDown: function() {
@@ -1420,7 +1420,7 @@
1420 var filter_node = listing.one('#subscription-filter-0');1420 var filter_node = listing.one('#subscription-filter-0');
1421 var mute_label_node = filter_node.one('.mute-label');1421 var mute_label_node = filter_node.one('.mute-label');
1422 var mute_link = filter_node.one('a.mute-subscription');1422 var mute_link = filter_node.one('a.mute-subscription');
1423 this.lp_client.named_post.args = []1423 this.lp_client.named_post.args = [];
1424 mute_link.simulate('click');1424 mute_link.simulate('click');
1425 Assert.areEqual(this.lp_client.received[0][0], 'named_post');1425 Assert.areEqual(this.lp_client.received[0][0], 'named_post');
1426 Assert.areEqual(1426 Assert.areEqual(
@@ -1442,7 +1442,7 @@
1442 var filter_node = listing.one('#subscription-filter-0');1442 var filter_node = listing.one('#subscription-filter-0');
1443 var mute_label_node = filter_node.one('.mute-label');1443 var mute_label_node = filter_node.one('.mute-label');
1444 var mute_link = filter_node.one('a.mute-subscription');1444 var mute_link = filter_node.one('a.mute-subscription');
1445 this.lp_client.named_post.args = []1445 this.lp_client.named_post.args = [];
1446 mute_link.simulate('click');1446 mute_link.simulate('click');
1447 Assert.areEqual(this.lp_client.received[0][0], 'named_post');1447 Assert.areEqual(this.lp_client.received[0][0], 'named_post');
1448 Assert.areEqual(1448 Assert.areEqual(
@@ -1463,8 +1463,8 @@
1463 var listing = this.test_node.one(subscription_listing_id);1463 var listing = this.test_node.one(subscription_listing_id);
1464 var filter_node = listing.one('#subscription-filter-0');1464 var filter_node = listing.one('#subscription-filter-0');
1465 var mute_link = filter_node.one('a.mute-subscription');1465 var mute_link = filter_node.one('a.mute-subscription');
1466 this.lp_client.named_post.args = []1466 this.lp_client.named_post.args = [];
1467 this.lp_client.named_post.halt = true1467 this.lp_client.named_post.halt = true;
1468 mute_link.simulate('click');1468 mute_link.simulate('click');
1469 Assert.isTrue(mute_link.hasClass('spinner'));1469 Assert.isTrue(mute_link.hasClass('spinner'));
1470 Assert.isFalse(mute_link.hasClass('no'));1470 Assert.isFalse(mute_link.hasClass('no'));
@@ -1482,9 +1482,9 @@
1482 var listing = this.test_node.one(subscription_listing_id);1482 var listing = this.test_node.one(subscription_listing_id);
1483 var filter_node = listing.one('#subscription-filter-0');1483 var filter_node = listing.one('#subscription-filter-0');
1484 var mute_link = filter_node.one('a.mute-subscription');1484 var mute_link = filter_node.one('a.mute-subscription');
1485 this.lp_client.named_post.fail = true1485 this.lp_client.named_post.fail = true;
1486 this.lp_client.named_post.args = [true, true];1486 this.lp_client.named_post.args = [true, true];
1487 this.lp_client.named_post.halt = true1487 this.lp_client.named_post.halt = true;
1488 mute_link.simulate('click');1488 mute_link.simulate('click');
1489 Assert.isTrue(mute_link.hasClass('spinner'));1489 Assert.isTrue(mute_link.hasClass('spinner'));
1490 Assert.isFalse(mute_link.hasClass('no'));1490 Assert.isFalse(mute_link.hasClass('no'));
@@ -1495,6 +1495,66 @@
14951495
1496 }));1496 }));
14971497
1498 suite.add(new Y.Test.Case({
1499 name: 'Structural Subscription: enable/disable help link',
1500
1501 _should: {error: {}},
1502
1503 setUp: function() {
1504 this.original_lp = monkeypatch_LP();
1505
1506 LP.cache.subscription_info = [{
1507 target_url: 'http://example.com',
1508 target_title:'Example project',
1509 filters: [{
1510 filter: {
1511 description: 'DESCRIPTION',
1512 statuses: [],
1513 importances: [],
1514 tags: [],
1515 find_all_tags: true,
1516 bug_notification_level: 'Discussion',
1517 self_link: 'http://example.com/a_filter'
1518 },
1519 can_mute: true,
1520 is_muted: false,
1521 subscriber_is_team: true,
1522 subscriber_url: 'http://example.com/subscriber',
1523 subscriber_title: 'Thidwick',
1524 user_is_team_admin: false
1525 }]
1526 }];
1527
1528
1529 this.configuration = {
1530 content_box: content_box_id,
1531 lp_client: make_lp_client_stub()
1532 };
1533 this.content_node = create_test_node(true);
1534 Y.one('body').appendChild(this.content_node);
1535 },
1536
1537 tearDown: function() {
1538 window.LP = this.original_lp;
1539 remove_test_node();
1540 delete this.content_node;
1541 },
1542
1543 test_help_link_hover: function() {
1544 module.setup_bug_subscriptions(this.configuration);
1545
1546 // Initially the help link is not visible.
1547 var help = Y.one('a.mute-help');
1548 Assert.isFalse(help.getStyle('visibility') === 'visible');
1549
1550 // If we hover over the enable/disable (mute) link the help link
1551 // becomes visible.
1552 Y.one('a.mute-subscription').simulate('mouseover');
1553 Assert.areEqual('visible', help.getStyle('visibility'));
1554 }
1555
1556 }));
1557
1498 // Lock, stock, and two smoking barrels.1558 // Lock, stock, and two smoking barrels.
1499 var handle_complete = function(data) {1559 var handle_complete = function(data) {
1500 var status_node = Y.Node.create(1560 var status_node = Y.Node.create(

Subscribers

People subscribed via source and target branches

to status/vote changes: