Merge lp:~benji/launchpad/fix-help-link-3 into lp:launchpad/db-devel

Proposed by Benji York
Status: Merged
Approved by: Aaron Bentley
Approved revision: no longer in the source branch.
Merged at revision: 10456
Proposed branch: lp:~benji/launchpad/fix-help-link-3
Merge into: lp:launchpad/db-devel
Diff against target: 57 lines (+13/-6)
1 file modified
lib/lp/registry/javascript/structural-subscription.js (+13/-6)
To merge this branch: bzr merge lp:~benji/launchpad/fix-help-link-3
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+58524@code.launchpad.net

Commit message

[r=abentley][no-qa] fix help link visibility in Chrome

Description of the change

This branch fixes a small bug: the help link next to the "Stop my emails
from this subscription" link wasn't appearing on Chrome. I'm still not
sure why not, but the work-around was simple enough.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

It might make sense to change can_edit to a function to reduce code duplication, but either way, this is fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/javascript/structural-subscription.js'
2--- lib/lp/registry/javascript/structural-subscription.js 2011-04-19 07:18:42 +0000
3+++ lib/lp/registry/javascript/structural-subscription.js 2011-04-20 16:38:06 +0000
4@@ -1193,6 +1193,13 @@
5 }
6
7 /**
8+ * Figure out if the user can edit a particular structural subscription.
9+ */
10+function can_edit(filter_info) {
11+ return !filter_info.subscriber_is_team || filter_info.user_is_team_admin;
12+}
13+
14+/**
15 * Attach activation (click) handlers to links for a particular filter.
16 */
17 function wire_up_edit_links_for_filter(
18@@ -1204,8 +1211,7 @@
19 var mute_link = node.one('a.mute-subscription');
20 mute_link.on('click', make_mute_handler(filter_info, node));
21 }
22- if (!filter_info.subscriber_is_team ||
23- filter_info.user_is_team_admin) {
24+ if (can_edit(filter_info)) {
25 var edit_link = node.one('a.edit-subscription');
26 var edit_handler = make_edit_handler(
27 subscription, filter_info, filter_id, config);
28@@ -1276,9 +1282,6 @@
29 'do not receive emails from this subscription.</em>'));
30 }
31
32- var can_edit = (!filter_info.subscriber_is_team ||
33- filter_info.user_is_team_admin);
34-
35 var control = filter_node.appendChild(
36 Y.Node.create('<span style="float: right"></span>'));
37
38@@ -1291,6 +1294,9 @@
39 ' href="/+help/structural-subscription-mute.html">'+
40 ' <span class="invisible-link">Delivery help</span>'+
41 '</a>'));
42+ // For some reason the help link will not appear in Chrome unless
43+ // there is a non-empty element immediately after the help node.
44+ control.append(Y.Node.create('<span>&nbsp;</span>'));
45 // We store a reference to the timeout that will hide the help link so
46 // we can cancel it if needed.
47 var hide_help_timeout;
48@@ -1309,7 +1315,8 @@
49 link.on('hover', show_help, hide_help);
50 help.on('hover', show_help, hide_help);
51 }
52- if (can_edit) {
53+
54+ if (can_edit(filter_info)) {
55 // User can edit the subscription.
56 control.append(Y.Node.create(
57 '<a href="#" style="margin-right: 2em;"'+

Subscribers

People subscribed via source and target branches

to status/vote changes: