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
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
index 299c12a..deaa094 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
@@ -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 => {