Make mergeable check more explicit
The 'mergeable' property of a change exists only if it is specifically asked for, otherwise it is undefined. This was causing some false positives when checking for merge conflicts. Also removes some dead code. Bug: Issue 6819 Change-Id: Ib42bac8067afacb09d20cd122f9d9f41425207e0
This commit is contained in:
@@ -122,7 +122,8 @@ limitations under the License.
|
|||||||
states.push('Merged');
|
states.push('Merged');
|
||||||
} else if (change.status === this.ChangeStatus.ABANDONED) {
|
} else if (change.status === this.ChangeStatus.ABANDONED) {
|
||||||
states.push('Abandoned');
|
states.push('Abandoned');
|
||||||
} else if (!change.mergeable) {
|
} else if (change.mergeable === false) {
|
||||||
|
// 'mergeable' prop may not always exist (@see Issue 6819)
|
||||||
states.push('Merge Conflict');
|
states.push('Merge Conflict');
|
||||||
}
|
}
|
||||||
if (change.work_in_progress) { states.push('WIP'); }
|
if (change.work_in_progress) { states.push('WIP'); }
|
||||||
|
|||||||
@@ -100,11 +100,26 @@ limitations under the License.
|
|||||||
current_revision: 'rev1',
|
current_revision: 'rev1',
|
||||||
status: 'NEW',
|
status: 'NEW',
|
||||||
labels: {},
|
labels: {},
|
||||||
|
mergeable: false,
|
||||||
};
|
};
|
||||||
const status = element.changeStatusString(change);
|
const status = element.changeStatusString(change);
|
||||||
assert.equal(status, 'Merge Conflict');
|
assert.equal(status, 'Merge Conflict');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('mergeable prop undefined', () => {
|
||||||
|
const change = {
|
||||||
|
change_id: 'Iad9dc96274af6946f3632be53b106ef80f7ba6ca',
|
||||||
|
revisions: {
|
||||||
|
rev1: {_number: 1},
|
||||||
|
},
|
||||||
|
current_revision: 'rev1',
|
||||||
|
status: 'NEW',
|
||||||
|
labels: {},
|
||||||
|
};
|
||||||
|
const status = element.changeStatusString(change);
|
||||||
|
assert.equal(status, '');
|
||||||
|
});
|
||||||
|
|
||||||
test('Merged status', () => {
|
test('Merged status', () => {
|
||||||
const change = {
|
const change = {
|
||||||
change_id: 'Iad9dc96274af6946f3632be53b106ef80f7ba6ca',
|
change_id: 'Iad9dc96274af6946f3632be53b106ef80f7ba6ca',
|
||||||
|
|||||||
@@ -623,10 +623,6 @@
|
|||||||
return Gerrit.Nav.getUrlForChange(change);
|
return Gerrit.Nav.getUrlForChange(change);
|
||||||
},
|
},
|
||||||
|
|
||||||
_privateChanges(change) {
|
|
||||||
return change.is_private ? ' (Private)' : '';
|
|
||||||
},
|
|
||||||
|
|
||||||
_computeShowCommitInfo(changeStatus, current_revision) {
|
_computeShowCommitInfo(changeStatus, current_revision) {
|
||||||
return changeStatus === 'Merged' && current_revision;
|
return changeStatus === 'Merged' && current_revision;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user