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

Proposed by j.c.sackett on 2012-08-03
Status: Merged
Approved by: j.c.sackett on 2012-08-03
Approved revision: no longer in the source branch.
Merged at revision: 15743
Proposed branch: lp:~jcsackett/launchpad/info-type-from-main-host
Merge into: lp:launchpad
Diff against target: 27 lines (+3/-3)
2 files modified
lib/lp/bugs/javascript/information_type_choice.js (+1/-2)
lib/lp/bugs/javascript/tests/test_information_type_choice.js (+2/-1)
To merge this branch: bzr merge lp:~jcsackett/launchpad/info-type-from-main-host
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code 2012-08-03 Approve on 2012-08-03
Review via email: mp+118128@code.launchpad.net

Commit Message

Fixes information_type_choice module so that it works on the bug and main hosts.

Description of the Change

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

To post a comment you must log in.
Brad Crittenden (bac) wrote :

Lovely

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/javascript/information_type_choice.js'
2--- lib/lp/bugs/javascript/information_type_choice.js 2012-07-17 03:51:38 +0000
3+++ lib/lp/bugs/javascript/information_type_choice.js 2012-08-03 15:37:21 +0000
4@@ -44,8 +44,7 @@
5 update_privacy_portlet(orig_value);
6 return false;
7 };
8- var base_url = LP.cache.context.web_link;
9- var submit_url = base_url+"/+secrecy";
10+ var submit_url = document.URL + "/+secrecy";
11 var qs = Y.lp.client.append_qs('', 'field.actions.change', 'Change');
12 qs = Y.lp.client.append_qs(qs, 'field.information_type', value);
13 var sub_list_node = Y.one('#other-bug-subscribers');
14
15=== modified file 'lib/lp/bugs/javascript/tests/test_information_type_choice.js'
16--- lib/lp/bugs/javascript/tests/test_information_type_choice.js 2012-07-17 14:10:53 +0000
17+++ lib/lp/bugs/javascript/tests/test_information_type_choice.js 2012-08-03 15:37:21 +0000
18@@ -100,7 +100,8 @@
19 responseText: '{"subscription_data": "subscribers",' +
20 '"cache_data": {"item": "value"}}',
21 responseHeaders: {'Content-Type': 'application/json'}});
22- Y.Assert.areEqual('/+secrecy', mockio.last_request.url);
23+ Y.Assert.areEqual(
24+ document.URL + '/+secrecy', mockio.last_request.url);
25 Y.Assert.areEqual(
26 'field.actions.change=Change&' +
27 'field.information_type=USERDATA',