Render change edits on change and diff screens
ORIGINALLY: Iafd4b80af53624027c347f0f443b4cdfde292e29 This change makes the change view and the diff view change edit aware. Mutation operations on edit itself, like editing files in editor, are beyond the scope of this change. Change edits must be fetched with a separate change edit endpoint and merged into the change.revisions object. The _number of an editInfo is 'edit'. It has a special property called 'basePatchNum' that marks which patch set the edit is based on. In patch set selectors, the edit is sorted right after its basePatchNum. Alternative implementation considerations: It could be easier to handle edits on the Polygerrit UI, if GET /changes/<id>/detail endpoint would optionally include the change edit in the resulting change.revsions map. TODOs: * Overwrite change.current_revision with change edit commit in some use cases * Mark the change edit as Change Edit in the header of the change view * Allow for modification of the edit in the change/diff view * Disable commenting on files in edit patchsets * Modify file list rows to have appropriate actions when edit is selected (e.g. allow revert, disable marking as reviewed) * Identify and whitelist valid change/revision actions for an edit Bug: Issue 4437 Change-Id: Ia4690d20954de730cd625ac76920e849beb12f7c
This commit is contained in:
committed by
Kasper Nilsson
parent
389d241c30
commit
e6a6f44f8c
@@ -664,21 +664,29 @@ limitations under the License.
|
||||
revisions: {
|
||||
rev1: {_number: 1},
|
||||
rev2: {_number: 2},
|
||||
rev3: {_number: 3},
|
||||
rev3: {_number: 'edit', basePatchNum: 2},
|
||||
rev4: {_number: 3},
|
||||
},
|
||||
};
|
||||
element.revisions = [
|
||||
{_number: 1},
|
||||
{_number: 2},
|
||||
{_number: 'edit', basePatchNum: 2},
|
||||
{_number: 3},
|
||||
];
|
||||
|
||||
flush(() => {
|
||||
const selectEl = element.$.patchChange;
|
||||
assert.equal(selectEl.nativeSelect.value, 'PARENT');
|
||||
assert.isTrue(element.$$('option[value="3"]').hasAttribute('disabled'));
|
||||
selectEl.addEventListener('change', () => {
|
||||
assert.equal(selectEl.nativeSelect.value, '2');
|
||||
assert(navStub.lastCall.calledWithExactly(element.change, '3', '2'),
|
||||
'Should navigate to /c/42/2..3');
|
||||
assert.equal(selectEl.nativeSelect.value, 'edit');
|
||||
assert(navStub.lastCall.calledWithExactly(element.change, '3', 'edit'),
|
||||
'Should navigate to /c/42/edit..3');
|
||||
navStub.restore();
|
||||
done();
|
||||
});
|
||||
selectEl.nativeSelect.value = '2';
|
||||
selectEl.nativeSelect.value = 'edit';
|
||||
element.fire('change', {}, {node: selectEl.nativeSelect});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user