← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Benji York has proposed merging lp:~benji/launchpad/bug-753152 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #753152 in Launchpad itself: "You should only be able to mute team subscriptions that are not delivered to you via a mailing list"
  https://bugs.launchpad.net/launchpad/+bug/753152

For more details, see:
https://code.launchpad.net/~benji/launchpad/bug-753152/+merge/57553

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));

-- 
https://code.launchpad.net/~benji/launchpad/bug-753152/+merge/57553
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~benji/launchpad/bug-753152 into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/tests/test_bug_context_menu.py'
--- lib/lp/bugs/browser/tests/test_bug_context_menu.py	2011-03-09 14:07:35 +0000
+++ lib/lp/bugs/browser/tests/test_bug_context_menu.py	2011-04-13 18:14:34 +0000
@@ -8,16 +8,20 @@
 from zope.component import getUtility
 
 from canonical.launchpad.webapp.interfaces import IOpenLaunchBag
+from canonical.launchpad.webapp.servers import LaunchpadTestRequest
 from canonical.testing.layers import DatabaseFunctionalLayer
 
 from lp.bugs.browser.bug import BugContextMenu
 from lp.bugs.enum import BugNotificationLevel
+from lp.services.features import get_relevant_feature_controller
 from lp.testing import (
     feature_flags,
     person_logged_in,
     set_feature_flag,
     TestCaseWithFactory,
     )
+from lp.testing.views import create_initialized_view
+
 
 class TestBugContextMenu(TestCaseWithFactory):
 
@@ -65,3 +69,17 @@
                     person, person, level=BugNotificationLevel.NOTHING)
                 link = self.context_menu.mute_subscription()
                 self.assertEqual("Unmute bug mail", link.text)
+
+    def test_mute_help_available(self):
+        # There is a help link available next to the mute/unmute button.
+        person = self.factory.makePerson()
+        with feature_flags():
+            with person_logged_in(person):
+                self.bug.subscribe(
+                    person, person, level=BugNotificationLevel.NOTHING)
+                request = LaunchpadTestRequest()
+                request.features = get_relevant_feature_controller()
+                view = create_initialized_view(
+                    self.bug, name="+portlet-subscribers", request=request)
+                html = view.render()
+        self.assertTrue('class="sprite maybe mute-help"' in html)

=== 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-13 18:14:34 +0000
@@ -0,0 +1,30 @@
+<html>
+  <head>
+    <title>What happens when I "mute" or "unmute" a bug?</title>
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssreset/reset.css" />
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssfonts/fonts.css" />
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssbase/base.css" />
+  </head>
+  <body>
+    <h1>What happens when I "mute" a bug?</h1>
+
+    <p>
+      You may have a subscription to a bug target that sends email
+      notifications abotu bug activity.  However, you may not be interested in
+      a particular bug.  In that case you can "mute" the bug and you will not
+      recieve notifications about it.
+    </p>
+    <p>
+      When "unmuting" a bug you are asked what kinds of messages you would
+      like to recieve about the bug.
+    </p>
+    <p>
+      If you are subscribed via a team, but the team delivers its bug messages
+      via a mailing list or some other preferred email, the mute will not be
+      honored because doing so would prevent the other team members from
+      recieving the notifications.
+  </body>
+</html>

=== modified file 'lib/lp/bugs/javascript/bugtask_index_portlets.js'
--- lib/lp/bugs/javascript/bugtask_index_portlets.js	2011-03-24 14:13:45 +0000
+++ lib/lp/bugs/javascript/bugtask_index_portlets.js	2011-04-13 18:14:34 +0000
@@ -84,9 +84,8 @@
 
     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));
 
         // Fire a custom portlet loaded event to notify when
         // it's safe to setup subscriber link callbacks.
@@ -194,7 +193,7 @@
         };
         lp_client.named_post(bug_repr.self_link, 'subscribe', config);
     });
-}
+};
 
 function load_subscriber_ids() {
     function on_success(transactionid, response, args) {
@@ -523,7 +522,7 @@
     var is_dupe;
     var icon_parent_div = icon_parent.get('parentNode');
     var dupe_id = 'dupe-' + person.get('css_name');
-    if (icon_parent_div.get('id') == dupe_id) {
+    if (icon_parent_div.get('id') === dupe_id) {
         is_dupe = true;
     } else {
         is_dupe = false;
@@ -680,8 +679,8 @@
         subscription_overlay.show();
     }
     var config = {
-        on: {success: on_success, failure: on_failure},
-    }
+        on: {success: on_success, failure: on_failure}
+    };
     Y.io(subscription_link_url, config);
 }
 
@@ -1033,7 +1032,7 @@
     var all_subscribers = Y.all('#subscribers-links div');
     if (all_subscribers.size() > 0) {
         all_subscribers.each(function(sub_link) {
-            if (sub_link.getAttribute('id') != 'temp-username') {
+            if (sub_link.getAttribute('id') !== 'temp-username') {
                 // User's displayname is found via the link's "name"
                 // attribute.
                 var sub_link_name = sub_link.one('a').getAttribute('name');
@@ -1077,7 +1076,7 @@
     } else if (can_be_unsubscribed) {
         // If the user belongs in the first list, loop the list for position.
         for (i=0; i<unsubscribables.length; i++) {
-            if (unsubscribables[i] == full_name) {
+            if (unsubscribables[i] === full_name) {
                 if (i+1 < unsubscribables.length) {
                     return nodes_by_name[unsubscribables[i+1]];
                 // If the current link should go at the end of the first
@@ -1092,7 +1091,7 @@
     } else if (!can_be_unsubscribed) {
         // If user belongs in the second list, loop the list for position.
         for (i=0; i<not_unsubscribables.length; i++) {
-            if (not_unsubscribables[i] == full_name) {
+            if (not_unsubscribables[i] === full_name) {
                 if (i+1 < not_unsubscribables.length) {
                     return nodes_by_name[not_unsubscribables[i+1]];
                 } else {
@@ -1120,7 +1119,7 @@
 
     // Strip the domain off. We just want a path.
     var host_start = user_uri.indexOf('//');
-    if (host_start != -1) {
+    if (host_start !== -1) {
         var host_end = user_uri.indexOf('/', host_start+2);
         return user_uri.substring(host_end, user_uri.length);
     }
@@ -1218,7 +1217,7 @@
             form_data['field.bug_notification_level']);
         subscribe_current_user(subscription);
     } else if (
-        form_data['field.subscription'] == 'update-subscription') {
+        form_data['field.subscription'] === 'update-subscription') {
         // The user is already subscribed or is muted and wants to
         // update their subscription.
         setup_client_and_bug();
@@ -1235,7 +1234,7 @@
                     }
                     lp_subscription.set(
                         'bug_notification_level',
-                        form_data['field.bug_notification_level'][0])
+                        form_data['field.bug_notification_level'][0]);
                     save_config = {
                         on: {
                             success: function(e) {
@@ -1265,11 +1264,11 @@
                                 anim.run();
                             }
                         }
-                    }
+                    };
                     lp_subscription.lp_save(save_config);
                 }
             }
-        }
+        };
         lp_client.get(subscription_url, config);
     } else {
         // The user is already subscribed and wants to unsubscribe.
@@ -1338,8 +1337,9 @@
                     on: {
                         success: function(result) {
                             var team_member = false;
-                            for (var i=0; i<result.entries.length; i++) {
-                                 if (result.entries[i].member_link ==
+                            var i;
+                            for (i=0; i<result.entries.length; i++) {
+                                 if (result.entries[i].member_link ===
                                     Y.lp.client.get_absolute_uri(
                                         subscription.get(
                                             'subscriber').get('uri'))) {

=== modified file 'lib/lp/bugs/templates/bug-portlet-subscribers.pt'
--- lib/lp/bugs/templates/bug-portlet-subscribers.pt	2011-04-05 17:55:44 +0000
+++ lib/lp/bugs/templates/bug-portlet-subscribers.pt	2011-04-13 18:14:34 +0000
@@ -16,10 +16,13 @@
     <div tal:condition="request/features/malone.advanced-structural-subscriptions.enabled"
         tal:content="structure context_menu/editsubscriptions/render" />
     <tal:show-mute condition="view/user_should_see_mute_link">
-      <div
-        tal:attributes="class view/current_user_mute_class"
-        tal:content="structure context_menu/mute_subscription/render" />
-      <div id="mute-unmute-spinner">Unmuting...</div>
+      <div tal:attributes="class view/current_user_mute_class">
+        <span tal:replace="structure context_menu/mute_subscription/render"/>
+        <a target="help" class="sprite maybe mute-help"
+            href="/+help/structural-subscription-mute.html"
+          >&nbsp;<span class="invisible-link">Mute help</span></a>
+        <div style="float: left" id="mute-unmute-spinner">Unmuting...</div>
+      </div>
     </tal:show-mute>
   </div>
   <a id="subscribers-ids-link"