Strip unused modifiers from URLs with Change IDs
This change replicates the behavior of the GWTUI that stripped the n,z modifier from change URLs, as seen in http://goo.gl/timWzy Links from Gitiles still contain these modifiers, but they are not supported by the backend. Also includes a small change left over from c/85964 to ensure that no API calls are made during automated testing. Bug: Issue 4524 Change-Id: Ib58fb5347b39611a83708cf53a2a75bee454171e
This commit is contained in:
committed by
Andrew Bonventre
parent
a5d44b98cc
commit
e80c294223
@@ -37,6 +37,7 @@ limitations under the License.
|
||||
|
||||
setup(function() {
|
||||
element = fixture('basic');
|
||||
sinon.stub(element.$.restAPI, 'getLoggedIn').returns(true);
|
||||
});
|
||||
|
||||
test('reply event', function(done) {
|
||||
|
||||
@@ -94,7 +94,6 @@
|
||||
fetchJSON: function(url, opt_errFn, opt_cancelCondition, opt_params,
|
||||
opt_opts) {
|
||||
opt_opts = opt_opts || {};
|
||||
|
||||
var fetchOptions = {
|
||||
credentials: 'same-origin',
|
||||
headers: opt_opts.headers,
|
||||
@@ -312,6 +311,10 @@
|
||||
ListChangesOption.LABELS,
|
||||
ListChangesOption.DETAILED_ACCOUNTS
|
||||
);
|
||||
// Issue 4524: respect legacy token with max sortkey.
|
||||
if (opt_offset === 'n,z') {
|
||||
opt_offset = 0;
|
||||
}
|
||||
var params = {
|
||||
n: changesPerPage,
|
||||
O: options,
|
||||
|
||||
@@ -324,5 +324,11 @@ limitations under the License.
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('legacy n,z key in change url is replaced', function() {
|
||||
var stub = sandbox.stub(element, 'fetchJSON');
|
||||
element.getChanges(1, null, 'n,z');
|
||||
assert.equal(stub.args[0][3].S, 0);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user