From bad26826e70c76d69b9cfd6a4deaebe95dc372d3 Mon Sep 17 00:00:00 2001 From: Paladox none Date: Thu, 1 Jun 2017 15:20:23 +0000 Subject: [PATCH] PolyGerrit: Fix changes not loading We were prefixing the url twice since before we were doing _changeBaseURL(changeNum, opt_patchNum) { let v = '/changes/' + changeNum; if (opt_patchNum) { v += '/revisions/' + opt_patchNum; } return v; }, now we are doing changeBaseURL(changeNum, patchNum) { let v = this.getBaseUrl() + '/changes/' + changeNum; if (patchNum) { v += '/revisions/' + patchNum; } return v; }, But because the way we were doing it in gr-rest-api, some of the functions were adding baseUrl allready, so when we called getBaseUrl in changeBaseURL it was adding it twice. Change-Id: I2f51fb3ac658ebb659eaf52c858eb113c2f07382 --- .../gr-rest-api-interface/gr-rest-api-interface.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index 5bc427beca..b130f9af08 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -389,7 +389,7 @@ }, getChangeActionURL(changeNum, opt_patchNum, endpoint) { - return this.changeBaseURL(changeNum, opt_patchNum) + endpoint; + return this._changeBaseURL(changeNum, opt_patchNum) + endpoint; }, getChangeDetail(changeNum, opt_errFn, opt_cancelCondition) { @@ -729,7 +729,7 @@ }, _getDiffFetchURL(changeNum, patchNum, path) { - return this.changeBaseURL(changeNum, patchNum) + '/files/' + + return this._changeBaseURL(changeNum, patchNum) + '/files/' + encodeURIComponent(path) + '/diff'; }, @@ -827,7 +827,7 @@ }, _getDiffCommentsFetchURL(changeNum, endpoint, opt_patchNum) { - return this.changeBaseURL(changeNum, opt_patchNum) + endpoint; + return this._changeBaseURL(changeNum, opt_patchNum) + endpoint; }, saveDiffDraft(changeNum, patchNum, draft) { @@ -948,6 +948,14 @@ }); }, + _changeBaseURL(changeNum, opt_patchNum) { + let v = '/changes/' + changeNum; + if (opt_patchNum) { + v += '/revisions/' + opt_patchNum; + } + return v; + }, + setChangeTopic(changeNum, topic) { return this.send('PUT', '/changes/' + encodeURIComponent(changeNum) + '/topic', {topic});