Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/quick_actions/merge_request_actions.rb')
-rw-r--r--lib/gitlab/quick_actions/merge_request_actions.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/quick_actions/merge_request_actions.rb b/lib/gitlab/quick_actions/merge_request_actions.rb
index 47c76e98e5c..6348a4902f8 100644
--- a/lib/gitlab/quick_actions/merge_request_actions.rb
+++ b/lib/gitlab/quick_actions/merge_request_actions.rb
@@ -155,6 +155,20 @@ module Gitlab
@execution_message[:approve] = _('Approved the current merge request.')
end
+ desc _('Unapprove a merge request')
+ explanation _('Unapprove the current merge request.')
+ types MergeRequest
+ condition do
+ quick_action_target.persisted? && quick_action_target.can_be_unapproved_by?(current_user)
+ end
+ command :unapprove do
+ success = MergeRequests::RemoveApprovalService.new(project: quick_action_target.project, current_user: current_user).execute(quick_action_target)
+
+ next unless success
+
+ @execution_message[:unapprove] = _('Unapproved the current merge request.')
+ end
+
desc do
if quick_action_target.allows_multiple_reviewers?
_('Assign reviewer(s)')