Merge "Update patch range select to use changeComments"
This commit is contained in:
@@ -435,7 +435,7 @@ limitations under the License.
|
|||||||
all-patch-sets="[[_allPatchSets]]"
|
all-patch-sets="[[_allPatchSets]]"
|
||||||
change="[[_change]]"
|
change="[[_change]]"
|
||||||
change-num="[[_changeNum]]"
|
change-num="[[_changeNum]]"
|
||||||
comments="[[_changeComments.comments]]"
|
change-comments="[[_changeComments]]"
|
||||||
commit-info="[[_commitInfo]]"
|
commit-info="[[_commitInfo]]"
|
||||||
change-url="[[_computeChangeUrl(_change)]]"
|
change-url="[[_computeChangeUrl(_change)]]"
|
||||||
edit-loaded="[[_editLoaded]]"
|
edit-loaded="[[_editLoaded]]"
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ limitations under the License.
|
|||||||
<h3 class="label">Files</h3>
|
<h3 class="label">Files</h3>
|
||||||
<gr-patch-range-select
|
<gr-patch-range-select
|
||||||
id="rangeSelect"
|
id="rangeSelect"
|
||||||
comments="[[comments]]"
|
change-comments="[[changeComments]]"
|
||||||
change-num="[[changeNum]]"
|
change-num="[[changeNum]]"
|
||||||
patch-num="[[patchNum]]"
|
patch-num="[[patchNum]]"
|
||||||
base-patch-num="[[basePatchNum]]"
|
base-patch-num="[[basePatchNum]]"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
change: Object,
|
change: Object,
|
||||||
changeNum: String,
|
changeNum: String,
|
||||||
changeUrl: String,
|
changeUrl: String,
|
||||||
comments: Object,
|
changeComments: Object,
|
||||||
commitInfo: Object,
|
commitInfo: Object,
|
||||||
editLoaded: Boolean,
|
editLoaded: Boolean,
|
||||||
loggedIn: Boolean,
|
loggedIn: Boolean,
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ limitations under the License.
|
|||||||
<gr-patch-range-select
|
<gr-patch-range-select
|
||||||
id="rangeSelect"
|
id="rangeSelect"
|
||||||
change-num="[[_changeNum]]"
|
change-num="[[_changeNum]]"
|
||||||
comments="[[_changeComments.comments]]"
|
change-comments="[[_changeComments]]"
|
||||||
patch-num="[[_patchRange.patchNum]]"
|
patch-num="[[_patchRange.patchNum]]"
|
||||||
base-patch-num="[[_patchRange.basePatchNum]]"
|
base-patch-num="[[_patchRange.basePatchNum]]"
|
||||||
files-weblinks="[[_filesWeblinks]]"
|
files-weblinks="[[_filesWeblinks]]"
|
||||||
|
|||||||
@@ -34,18 +34,18 @@
|
|||||||
_baseDropdownContent: {
|
_baseDropdownContent: {
|
||||||
type: Object,
|
type: Object,
|
||||||
computed: '_computeBaseDropdownContent(availablePatches, patchNum,' +
|
computed: '_computeBaseDropdownContent(availablePatches, patchNum,' +
|
||||||
'_sortedRevisions, comments)',
|
'_sortedRevisions, changeComments)',
|
||||||
},
|
},
|
||||||
_patchDropdownContent: {
|
_patchDropdownContent: {
|
||||||
type: Object,
|
type: Object,
|
||||||
computed: '_computePatchDropdownContent(availablePatches,' +
|
computed: '_computePatchDropdownContent(availablePatches,' +
|
||||||
'basePatchNum, _sortedRevisions, comments)',
|
'basePatchNum, _sortedRevisions, changeComments)',
|
||||||
},
|
},
|
||||||
changeNum: String,
|
changeNum: String,
|
||||||
// In the case of a patch range select (like diff view) comments should
|
// In the case of a patch range select (like diff view) comments should
|
||||||
// be an empty array, so that the patch and base content computed values
|
// be an empty array, so that the patch and base content computed values
|
||||||
// get triggered.
|
// get triggered.
|
||||||
comments: {
|
changeComments: {
|
||||||
type: Object,
|
type: Object,
|
||||||
value: () => { return {}; },
|
value: () => { return {}; },
|
||||||
},
|
},
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
behaviors: [Gerrit.PatchSetBehavior],
|
behaviors: [Gerrit.PatchSetBehavior],
|
||||||
|
|
||||||
_computeBaseDropdownContent(availablePatches, patchNum, _sortedRevisions,
|
_computeBaseDropdownContent(availablePatches, patchNum, _sortedRevisions,
|
||||||
comments) {
|
changeComments) {
|
||||||
const dropdownContent = [];
|
const dropdownContent = [];
|
||||||
for (const basePatch of availablePatches) {
|
for (const basePatch of availablePatches) {
|
||||||
const basePatchNum = basePatch.num;
|
const basePatchNum = basePatch.num;
|
||||||
@@ -73,9 +73,10 @@
|
|||||||
basePatch.num, patchNum, _sortedRevisions),
|
basePatch.num, patchNum, _sortedRevisions),
|
||||||
triggerText: `Patchset ${basePatchNum}`,
|
triggerText: `Patchset ${basePatchNum}`,
|
||||||
text: `Patchset ${basePatchNum}` +
|
text: `Patchset ${basePatchNum}` +
|
||||||
this._computePatchSetCommentsString(this.comments, basePatchNum),
|
this._computePatchSetCommentsString(changeComments.comments,
|
||||||
mobileText: this._computeMobileText(basePatchNum, comments,
|
basePatchNum),
|
||||||
_sortedRevisions),
|
mobileText: this._computeMobileText(basePatchNum,
|
||||||
|
changeComments.comments, _sortedRevisions),
|
||||||
bottomText: `${this._computePatchSetDescription(
|
bottomText: `${this._computePatchSetDescription(
|
||||||
_sortedRevisions, basePatchNum)}`,
|
_sortedRevisions, basePatchNum)}`,
|
||||||
value: basePatch.num,
|
value: basePatch.num,
|
||||||
@@ -90,12 +91,12 @@
|
|||||||
|
|
||||||
_computeMobileText(patchNum, comments, revisions) {
|
_computeMobileText(patchNum, comments, revisions) {
|
||||||
return `${patchNum}` +
|
return `${patchNum}` +
|
||||||
`${this._computePatchSetCommentsString(this.comments, patchNum)}` +
|
`${this._computePatchSetCommentsString(comments, patchNum)}` +
|
||||||
`${this._computePatchSetDescription(revisions, patchNum, true)}`;
|
`${this._computePatchSetDescription(revisions, patchNum, true)}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
_computePatchDropdownContent(availablePatches, basePatchNum,
|
_computePatchDropdownContent(availablePatches, basePatchNum,
|
||||||
_sortedRevisions, comments) {
|
_sortedRevisions, changeComments) {
|
||||||
const dropdownContent = [];
|
const dropdownContent = [];
|
||||||
for (const patch of availablePatches) {
|
for (const patch of availablePatches) {
|
||||||
const patchNum = patch.num;
|
const patchNum = patch.num;
|
||||||
@@ -106,8 +107,8 @@
|
|||||||
patchNum,
|
patchNum,
|
||||||
text: `${patchNum === 'edit' ? '': 'Patchset '}${patchNum}` +
|
text: `${patchNum === 'edit' ? '': 'Patchset '}${patchNum}` +
|
||||||
`${this._computePatchSetCommentsString(
|
`${this._computePatchSetCommentsString(
|
||||||
this.comments, patchNum)}`,
|
changeComments.comments, patchNum)}`,
|
||||||
mobileText: this._computeMobileText(patchNum, comments,
|
mobileText: this._computeMobileText(patchNum, changeComments.comments,
|
||||||
_sortedRevisions),
|
_sortedRevisions),
|
||||||
bottomText: `${this._computePatchSetDescription(
|
bottomText: `${this._computePatchSetDescription(
|
||||||
_sortedRevisions, patchNum)}`,
|
_sortedRevisions, patchNum)}`,
|
||||||
|
|||||||
@@ -190,11 +190,13 @@ limitations under the License.
|
|||||||
// Should be recomputed for each available patch
|
// Should be recomputed for each available patch
|
||||||
sandbox.stub(element, '_computeBaseDropdownContent');
|
sandbox.stub(element, '_computeBaseDropdownContent');
|
||||||
assert.equal(element._computeBaseDropdownContent.callCount, 0);
|
assert.equal(element._computeBaseDropdownContent.callCount, 0);
|
||||||
element.set('comments', {
|
element.set('changeComments', {
|
||||||
file: [{
|
comments: {
|
||||||
message: 'test',
|
file: [{
|
||||||
patch_set: 2,
|
message: 'test',
|
||||||
}],
|
patch_set: 2,
|
||||||
|
}],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
assert.equal(element._computeBaseDropdownContent.callCount, 1);
|
assert.equal(element._computeBaseDropdownContent.callCount, 1);
|
||||||
});
|
});
|
||||||
@@ -242,11 +244,13 @@ limitations under the License.
|
|||||||
// Should be recomputed for each available patch
|
// Should be recomputed for each available patch
|
||||||
sandbox.stub(element, '_computePatchDropdownContent');
|
sandbox.stub(element, '_computePatchDropdownContent');
|
||||||
assert.equal(element._computePatchDropdownContent.callCount, 0);
|
assert.equal(element._computePatchDropdownContent.callCount, 0);
|
||||||
element.set('comments', {
|
element.set('changeComments', {
|
||||||
file: [{
|
comments: {
|
||||||
message: 'test',
|
file: [{
|
||||||
patch_set: 2,
|
message: 'test',
|
||||||
}],
|
patch_set: 2,
|
||||||
|
}],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
assert.equal(element._computePatchDropdownContent.callCount, 1);
|
assert.equal(element._computePatchDropdownContent.callCount, 1);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user