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
This commit is contained in:
Paladox none
2017-06-01 15:20:23 +00:00
parent 4d28854369
commit bad26826e7

View File

@@ -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});