← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/info-type-from-main-host into lp:launchpad

 

j.c.sackett has proposed merging lp:~jcsackett/launchpad/info-type-from-main-host into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/info-type-from-main-host/+merge/118128

Summary
=======
Switching infotype's on a bug breaks if you're looking at the bug on the main
host, rather than on the bug host.

This is because the info_type change module gets the post link using the bug's
web_link url and appending the secrecy view url stub onto it. +secrecy is
available regardless of whether you're on the bug host or the main host, so
there's no reason to use the web_link to get the full +secrecy url.

Implementation
==============
Switch the use of the web_link + "+secrecy" to use document.URL "+secrecy"

Tests
=====
bin/test -vvct information_type --layer=YUI

QA
==
Switch info type on the bug host and the main host for a bug. Both should
work.

LoC
===
This is part of disclosure.

Lint
====

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/javascript/tests/test_information_type_choice.js
  lib/lp/bugs/javascript/information_type_choice.js
-- 
https://code.launchpad.net/~jcsackett/launchpad/info-type-from-main-host/+merge/118128
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/info-type-from-main-host into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/information_type_choice.js'
--- lib/lp/bugs/javascript/information_type_choice.js	2012-07-17 03:51:38 +0000
+++ lib/lp/bugs/javascript/information_type_choice.js	2012-08-03 15:37:21 +0000
@@ -44,8 +44,7 @@
         update_privacy_portlet(orig_value);
         return false;
     };
-    var base_url = LP.cache.context.web_link;
-    var submit_url = base_url+"/+secrecy";
+    var submit_url = document.URL + "/+secrecy";
     var qs = Y.lp.client.append_qs('', 'field.actions.change', 'Change');
     qs = Y.lp.client.append_qs(qs, 'field.information_type', value);
     var sub_list_node = Y.one('#other-bug-subscribers');

=== modified file 'lib/lp/bugs/javascript/tests/test_information_type_choice.js'
--- lib/lp/bugs/javascript/tests/test_information_type_choice.js	2012-07-17 14:10:53 +0000
+++ lib/lp/bugs/javascript/tests/test_information_type_choice.js	2012-08-03 15:37:21 +0000
@@ -100,7 +100,8 @@
                 responseText: '{"subscription_data": "subscribers",' +
                     '"cache_data": {"item": "value"}}',
                 responseHeaders: {'Content-Type': 'application/json'}});
-            Y.Assert.areEqual('/+secrecy', mockio.last_request.url);
+            Y.Assert.areEqual(
+                document.URL + '/+secrecy', mockio.last_request.url);
             Y.Assert.areEqual(
                 'field.actions.change=Change&' +
                 'field.information_type=USERDATA',


Follow ups