diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 11:41:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-14 11:41:52 +0300 |
commit | 585826cb22ecea5998a2c2a4675735c94bdeedac (patch) | |
tree | 5b05f0b30d33cef48963609e8a18a4dff260eab3 /lib/gitlab/quick_actions | |
parent | df221d036e5d0c6c0ee4d55b9c97f481ee05dee8 (diff) |
Add latest changes from gitlab-org/gitlab@16-6-stable-eev16.6.0-rc42
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r-- | lib/gitlab/quick_actions/merge_request_actions.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/quick_actions/merge_request_actions.rb b/lib/gitlab/quick_actions/merge_request_actions.rb index 9798b0eca2c..72bec159226 100644 --- a/lib/gitlab/quick_actions/merge_request_actions.rb +++ b/lib/gitlab/quick_actions/merge_request_actions.rb @@ -172,6 +172,25 @@ module Gitlab end end + desc { _('Request changes') } + explanation { _('Request changes to the current merge request.') } + types MergeRequest + condition do + Feature.enabled?(:mr_request_changes, current_user) && + quick_action_target.persisted? && + quick_action_target.find_reviewer(current_user) + end + command :request_changes do + result = ::MergeRequests::UpdateReviewerStateService.new(project: quick_action_target.project, current_user: current_user) + .execute(quick_action_target, "requested_changes") + + @execution_message[:request_changes] = if result[:status] == :success + _('Changes requested to the current merge request.') + else + result[:message] + end + end + desc { _('Approve a merge request') } explanation { _('Approve the current merge request.') } types MergeRequest @@ -197,6 +216,10 @@ module Gitlab next unless success + ::MergeRequests::UpdateReviewerStateService + .new(project: quick_action_target.project, current_user: current_user) + .execute(quick_action_target, "unreviewed") + @execution_message[:unapprove] = _('Unapproved the current merge request.') end |