← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Benji York has proposed merging lp:~benji/launchpad/fix-help-link into lp:launchpad/db-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~benji/launchpad/fix-help-link/+merge/58519

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.

-- 
https://code.launchpad.net/~benji/launchpad/fix-help-link/+merge/58519
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~benji/launchpad/fix-help-link into lp:launchpad/db-devel.
=== modified file 'lib/canonical/launchpad/templates/launchpad-loginstatus.pt'
--- lib/canonical/launchpad/templates/launchpad-loginstatus.pt	2011-03-29 06:00:48 +0000
+++ lib/canonical/launchpad/templates/launchpad-loginstatus.pt	2011-04-20 15:20:29 +0000
@@ -7,7 +7,7 @@
 <div id="logincontrol" tal:condition="view/login_shown"
 ><a tal:attributes="href view/login_url">Log in / Register</a></div>
 <div id="logincontrol" tal:condition="view/logged_in">
-  <form action="+logout" method="post">
+  <form action="/+logout" method="post">
     <input type="hidden" name="loggingout" value="1" />
     <div id="rendertime" tal:condition="request/features/visible_render_time">Loading...</div>
     <div id="ajax-time" tal:condition="request/features/visible_render_time">

=== modified file 'lib/lp/bugs/javascript/bugtask_index.js'
--- lib/lp/bugs/javascript/bugtask_index.js	2011-04-12 12:16:03 +0000
+++ lib/lp/bugs/javascript/bugtask_index.js	2011-04-20 15:20:29 +0000
@@ -386,7 +386,7 @@
                     if (bugs_private_notification_enabled) {
                         if (Y.one('.global-notification').hasClass('hidden')) {
                             Y.one('.portlet.private').setStyle('color', '#333');
-                            Y.one('.portlet.private').setStyle('background-color', '#fbfbfb');
+                            Y.one('.portlet.private').setStyle('backgroundColor', '#fbfbfb');
                         }
                     }
                     Y.one('body').replaceClass('private', 'public');
@@ -454,7 +454,7 @@
             });
             var body_space = new Y.Anim({
                 node: 'body',
-                to: {'padding-top': '40px'},
+                to: {'paddingTop': '40px'},
                 duration: 0.2,
                 easing: Y.Easing.easeOut
             });
@@ -493,7 +493,7 @@
             });
             var body_space = new Y.Anim({
                 node: 'body',
-                to: {'padding-top': 0},
+                to: {'paddingTop': 0},
                 duration: 0.2,
                 easing: Y.Easing.easeOut
             });

=== modified file 'lib/lp/registry/javascript/structural-subscription.js'
--- lib/lp/registry/javascript/structural-subscription.js	2011-04-19 07:18:42 +0000
+++ lib/lp/registry/javascript/structural-subscription.js	2011-04-20 15:20:29 +0000
@@ -1198,6 +1198,7 @@
 function wire_up_edit_links_for_filter(
     config, subscription, subscription_id, filter_info, filter_id,
     filter_node) {
+<<<<<<< TREE
     var node = filter_node || Y.one(
         '#subscription-filter-'+filter_id.toString());
     if (filter_info.can_mute) {
@@ -1206,6 +1207,17 @@
     }
     if (!filter_info.subscriber_is_team ||
         filter_info.user_is_team_admin) {
+=======
+    var node = filter_node || Y.one(
+        '#subscription-filter-'+filter_id.toString());
+    if (filter_info.can_mute) {
+        var mute_link = node.one('a.mute-subscription');
+        mute_link.on('click', make_mute_handler(filter_info, node));
+    }
+    var can_edit = (!filter_info.subscriber_is_team ||
+                    filter_info.user_is_team_admin);
+    if (can_edit) {
+>>>>>>> MERGE-SOURCE
         var edit_link = node.one('a.edit-subscription');
         var edit_handler = make_edit_handler(
             subscription, filter_info, filter_id, config);
@@ -1270,46 +1282,92 @@
     filter_node.appendChild(Y.Node.create(
         '<strong class="filter-name"></strong>'));
 
-    if (filter_info.can_mute) {
-        filter_node.appendChild(Y.Node.create(
-            '<em class="mute-label" style="padding-left: 1em;">You '+
-                'do not receive emails from this subscription.</em>'));
-    }
-
-    var can_edit = (!filter_info.subscriber_is_team ||
-                    filter_info.user_is_team_admin);
-
-    var control = filter_node.appendChild(
-        Y.Node.create('<span style="float: right"></span>'));
-
-    if (filter_info.can_mute) {
-        var link = control.appendChild(Y.Node.create(
-            '<a href="#" class="sprite js-action mute-subscription"></a>'));
-        var help = control.appendChild(Y.Node.create(
-            '<a target="help" class="sprite maybe mute-help"'+
-            '    style="visibility: hidden;"'+
-            '    href="/+help/structural-subscription-mute.html">'+
-            '  <span class="invisible-link">Delivery help</span>'+
-            '</a>'));
-        // We store a reference to the timeout that will hide the help link so
-        // we can cancel it if needed.
-        var hide_help_timeout;
-        var show_help = function () {
-            help.setStyle('visibility', 'visible');
-            // Every time we trigger the display of the help link we need to
-            // cancel any pending hiding of the help link so it doesn't
-            // dissapear on us.  If there isn't one pending, this is a NOP.
-            clearTimeout(hide_help_timeout);
-        };
-        var hide_help = function () {
-            hide_help_timeout = setTimeout(function () {
-                help.setStyle('visibility', 'hidden');
-            }, 2000);
-        };
-        link.on('hover', show_help, hide_help);
-        help.on('hover', show_help, hide_help);
-    }
-    if (can_edit) {
+<<<<<<< TREE
+    if (filter_info.can_mute) {
+        filter_node.appendChild(Y.Node.create(
+            '<em class="mute-label" style="padding-left: 1em;">You '+
+                'do not receive emails from this subscription.</em>'));
+    }
+
+    var can_edit = (!filter_info.subscriber_is_team ||
+                    filter_info.user_is_team_admin);
+
+    var control = filter_node.appendChild(
+        Y.Node.create('<span style="float: right"></span>'));
+
+    if (filter_info.can_mute) {
+        var link = control.appendChild(Y.Node.create(
+            '<a href="#" class="sprite js-action mute-subscription"></a>'));
+        var help = control.appendChild(Y.Node.create(
+            '<a target="help" class="sprite maybe mute-help"'+
+            '    style="visibility: hidden;"'+
+            '    href="/+help/structural-subscription-mute.html">'+
+            '  <span class="invisible-link">Delivery help</span>'+
+            '</a>'));
+        // We store a reference to the timeout that will hide the help link so
+        // we can cancel it if needed.
+        var hide_help_timeout;
+        var show_help = function () {
+            help.setStyle('visibility', 'visible');
+            // Every time we trigger the display of the help link we need to
+            // cancel any pending hiding of the help link so it doesn't
+            // dissapear on us.  If there isn't one pending, this is a NOP.
+            clearTimeout(hide_help_timeout);
+        };
+        var hide_help = function () {
+            hide_help_timeout = setTimeout(function () {
+                help.setStyle('visibility', 'hidden');
+            }, 2000);
+        };
+        link.on('hover', show_help, hide_help);
+        help.on('hover', show_help, hide_help);
+    }
+    if (can_edit) {
+=======
+    if (filter_info.can_mute) {
+        filter_node.appendChild(Y.Node.create(
+            '<em class="mute-label" style="padding-left: 1em;">You '+
+                'do not receive emails from this subscription.</em>'));
+    }
+
+    var control = filter_node.appendChild(
+        Y.Node.create('<span style="float: right"></span>'));
+
+    if (filter_info.can_mute) {
+        var link = control.appendChild(Y.Node.create(
+            '<a href="#" class="sprite js-action mute-subscription"></a>'));
+        var help = control.appendChild(Y.Node.create(
+            '<a target="help" class="sprite maybe mute-help"'+
+            '    style="visibility: hidden;"'+
+            '    href="/+help/structural-subscription-mute.html">'+
+            '  <span class="invisible-link">Delivery help</span>'+
+            '</a>'));
+        // For some reason the help link will not appear in Chrome unless
+        // there is a non-empty element immediately after the help node.
+        control.append(Y.Node.create('<span>&nbsp;</span>'));
+        // We store a reference to the timeout that will hide the help link so
+        // we can cancel it if needed.
+        var hide_help_timeout;
+        var show_help = function () {
+            help.setStyle('visibility', 'visible');
+            // Every time we trigger the display of the help link we need to
+            // cancel any pending hiding of the help link so it doesn't
+            // dissapear on us.  If there isn't one pending, this is a NOP.
+            clearTimeout(hide_help_timeout);
+        };
+        var hide_help = function () {
+            hide_help_timeout = setTimeout(function () {
+                help.setStyle('visibility', 'hidden');
+            }, 2000);
+        };
+        link.on('hover', show_help, hide_help);
+        help.on('hover', show_help, hide_help);
+    }
+
+    var can_edit = (!filter_info.subscriber_is_team ||
+                    filter_info.user_is_team_admin);
+    if (can_edit) {
+>>>>>>> MERGE-SOURCE
         // User can edit the subscription.
         control.append(Y.Node.create(
             '<a href="#" style="margin-right: 2em;"'+

=== modified file 'scripts/get-stacked-on-branches.py'
--- scripts/get-stacked-on-branches.py	2010-04-27 19:48:39 +0000
+++ scripts/get-stacked-on-branches.py	2011-04-20 15:20:29 +0000
@@ -11,11 +11,12 @@
 
 Prints the stacked branches in Launchpad to standard output in the following
 format:
-  <id> <branch_type> <unique_name> <stacked_on_unique_name>
+  <id> <branch_type> <unique_name> <stacked_on_id> <stacked_on_unique_name>
 
 <id> is the database ID of the Branch as a decimal integer.
 <branch_type> is the name of the BranchType, e.g. 'HOSTED'.
 <unique_name> is the unique_name property of the Branch.
+<stacked_on_id> is the database ID of the Branch.stacked_on branch
 <stacked_on_unique_name> is the unique_name property of the Branch.stacked_on
     branch.
 
@@ -49,9 +50,10 @@
     """
     execute_zcml_for_scripts()
     for db_branch in get_stacked_branches():
-        print '%s %s %s %s' % (
+        stacked_on = db_branch.stacked_on
+        print '%s %s %s %s %s' % (
             db_branch.id, db_branch.branch_type.name, db_branch.unique_name,
-            db_branch.stacked_on.unique_name)
+            stacked_on.id, stacked_on.unique_name)
 
 
 if __name__ == '__main__':

=== modified file 'scripts/update-stacked-on.py'
--- scripts/update-stacked-on.py	2010-05-19 18:07:56 +0000
+++ scripts/update-stacked-on.py	2011-04-20 15:20:29 +0000
@@ -8,7 +8,7 @@
 """Update stacked_on_location for all Bazaar branches.
 
 Expects standard input of:
-    '<id> <branch_type> <unique_name> <stacked_on_unique_name>\n'.
+    '<id> <branch_type> <unique_name> <stacked_on_id> <stacked_on_unique_name>\n'.
 
 Such input can be provided using "get-stacked-on-branches.py".
 
@@ -21,6 +21,7 @@
 __metaclass__ = type
 
 import _pythonpath
+from collections import namedtuple
 import sys
 
 from bzrlib.bzrdir import BzrDir
@@ -29,9 +30,13 @@
 
 from lp.codehosting.vfs import get_rw_server, get_ro_server
 from lp.codehosting.bzrutils import get_branch_stacked_on_url
+from lp.code.interfaces.codehosting import branch_id_alias
 from lp.services.scripts.base import LaunchpadScript
 
 
+FakeBranch = namedtuple('FakeBranch', 'id')
+
+
 def set_branch_stacked_on_url(bzrdir, stacked_on_url):
     """Set the stacked_on_location for the branch at 'bzrdir'.
 
@@ -57,6 +62,10 @@
             dest="dry_run",
             help=("Don't change anything on disk, just go through the "
                   "motions."))
+        self.parser.add_option(
+            '-i', '--id', default=False, action="store_true",
+            dest="stack_on_id",
+            help=("Stack on the +branch-id alias."))
 
     def main(self):
         if self.options.dry_run:
@@ -131,8 +140,12 @@
         """
         for branch_info in branches:
             (branch_id, branch_type, unique_name,
-             stacked_on_name) = branch_info
-            stacked_on_location = '/' + stacked_on_name
+             stacked_on_id, stacked_on_name) = branch_info
+            if self.options.stack_on_id:
+                branch = FakeBranch(stacked_on_id)
+                stacked_on_location = branch_id_alias(branch)
+            else:
+                stacked_on_location = '/' + stacked_on_name
             self.updateStackedOn(
                 branch_id, 'lp-internal:///' + unique_name,
                 stacked_on_location)