Filter revert submission button from change actions
Revert button allows user to choose between revert submission, changes. No need to display the revert submission button now. Change-Id: Ib339c1ef27bf51c1aa152dd54f34752065a2edc1
This commit is contained in:
@@ -197,6 +197,12 @@
|
||||
REVERT_SUBMISSION: 2,
|
||||
};
|
||||
|
||||
/* Revert submission is skipped as the normal revert dialog will now show
|
||||
the user a choice between reverting single change or an entire submission.
|
||||
Hence, a second button is not needed.
|
||||
*/
|
||||
const SKIP_ACTION_KEYS = [ChangeActions.REVERT_SUBMISSION];
|
||||
|
||||
/**
|
||||
* @appliesMixin Gerrit.FireMixin
|
||||
* @appliesMixin Gerrit.PatchSetMixin
|
||||
@@ -1470,7 +1476,8 @@
|
||||
action.icon = action.__key;
|
||||
}
|
||||
return action;
|
||||
});
|
||||
})
|
||||
.filter(action => !this._shouldSkipAction(action));
|
||||
}
|
||||
|
||||
_getActionPriority(action) {
|
||||
@@ -1508,6 +1515,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
_shouldSkipAction(action) {
|
||||
return SKIP_ACTION_KEYS.includes(action.__key);
|
||||
}
|
||||
|
||||
_computeTopLevelActions(actionRecord, hiddenActionsRecord) {
|
||||
const hiddenActions = hiddenActionsRecord.base || [];
|
||||
return actionRecord.base.filter(a => {
|
||||
|
||||
@@ -67,6 +67,12 @@ limitations under the License.
|
||||
title: 'Submit patch set 2 into master',
|
||||
enabled: true,
|
||||
},
|
||||
revert_submission: {
|
||||
method: 'POST',
|
||||
label: 'Revert submission',
|
||||
title: 'Revert this submission',
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
},
|
||||
send(method, url, payload) {
|
||||
@@ -126,6 +132,11 @@ limitations under the License.
|
||||
element._topLevelActions.length - 1);
|
||||
});
|
||||
|
||||
test('revert submission action is skipped', () => {
|
||||
assert.isFalse(element._allActionValues.includes(action =>
|
||||
action.key === 'revert_submission'));
|
||||
});
|
||||
|
||||
test('_shouldHideActions', () => {
|
||||
assert.isTrue(element._shouldHideActions(undefined, true));
|
||||
assert.isTrue(element._shouldHideActions({base: {}}, false));
|
||||
|
||||
Reference in New Issue
Block a user