← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/launchpad/bug-770245 into lp:launchpad

 

Brad Crittenden has proposed merging lp:~bac/launchpad/bug-770245 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #770245 in Launchpad itself: "Unsubscribing a team from a dupe doesn't work in advanced subscription overlay"
  https://bugs.launchpad.net/launchpad/+bug/770245

For more details, see:
https://code.launchpad.net/~bac/launchpad/bug-770245/+merge/59239

= Summary =

Unsubscribing a team from a bug that is subscribed to a duplicate was
not actually doing the unsubscribe.

== Proposed fix ==

Call both unsubscribe and unsubscribeFromDupes when unsubscribing a team.

== Pre-implementation notes ==

Chat with Danilo.

== Implementation details ==

As above.

== Tests ==

Hmm.

== Demo and Q/A ==


Link bug 2 to bug 1.
Subscribe a team directly to bug 2.
Unsubscribe that team from bug 1.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/javascript/bugtask_index_portlets.js
-- 
https://code.launchpad.net/~bac/launchpad/bug-770245/+merge/59239
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-770245 into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/bugtask_index_portlets.js'
--- lib/lp/bugs/javascript/bugtask_index_portlets.js	2011-04-22 22:31:33 +0000
+++ lib/lp/bugs/javascript/bugtask_index_portlets.js	2011-04-27 15:21:55 +0000
@@ -853,11 +853,31 @@
 
         parameters: { person: subscriber_link }
     };
-    if (subscription.is_direct_subscription() || subscription.is_team()) {
-        lp_client.named_post(bug_repr.self_link, 'unsubscribe', config);
-    } else {
-        lp_client.named_post(
-            bug_repr.self_link, 'unsubscribeFromDupes', config);
+
+    // A team must be unsubcribed from both the current bug and from
+    // duplicates.  This configuration handles the first and then
+    // chains to the other upon success.
+    var team_config = {
+        on: {
+            success: function(client) {
+                lp_client.named_post(
+                    bug_repr.self_link, 'unsubscribeFromDupes', config);
+            },
+            failure: error_handler.getFailureHandler()
+        },
+        parameters: { person: subscriber_link }
+    };
+
+    if (subscription.is_team()){
+        lp_client.named_post(bug_repr.self_link, 'unsubscribe', team_config);
+    }
+    else {
+        if (subscription.is_direct_subscription()) {
+            lp_client.named_post(bug_repr.self_link, 'unsubscribe', config);
+        } else {
+            lp_client.named_post(
+                bug_repr.self_link, 'unsubscribeFromDupes', config);
+        }
     }
 }