diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /lib/gitlab/quick_actions | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r-- | lib/gitlab/quick_actions/issuable_actions.rb | 12 | ||||
-rw-r--r-- | lib/gitlab/quick_actions/merge_request_actions.rb | 14 |
2 files changed, 20 insertions, 6 deletions
diff --git a/lib/gitlab/quick_actions/issuable_actions.rb b/lib/gitlab/quick_actions/issuable_actions.rb index 6aa3f515ef0..efe07aa8ab2 100644 --- a/lib/gitlab/quick_actions/issuable_actions.rb +++ b/lib/gitlab/quick_actions/issuable_actions.rb @@ -145,9 +145,9 @@ module Gitlab run_label_command(labels: find_labels(labels_param), command: :relabel, updates_key: :label_ids) end - desc _('Add a To Do') - explanation _('Adds a To Do.') - execution_message _('Added a To Do.') + desc _('Add a to do') + explanation _('Adds a to do.') + execution_message _('Added a to do.') types Issuable condition do quick_action_target.persisted? && @@ -157,9 +157,9 @@ module Gitlab @updates[:todo_event] = 'add' end - desc _('Mark To Do as done') - explanation _('Marks To Do as done.') - execution_message _('Marked To Do as done.') + desc _('Mark to do as done') + explanation _('Marks to do as done.') + execution_message _('Marked to do as done.') types Issuable condition do quick_action_target.persisted? && diff --git a/lib/gitlab/quick_actions/merge_request_actions.rb b/lib/gitlab/quick_actions/merge_request_actions.rb index 98db8ff761e..c8c949a9363 100644 --- a/lib/gitlab/quick_actions/merge_request_actions.rb +++ b/lib/gitlab/quick_actions/merge_request_actions.rb @@ -121,6 +121,20 @@ module Gitlab result[:message] end end + + desc _('Approve a merge request') + explanation _('Approve the current merge request.') + types MergeRequest + condition do + quick_action_target.persisted? && quick_action_target.can_be_approved_by?(current_user) + end + command :approve do + success = MergeRequests::ApprovalService.new(quick_action_target.project, current_user).execute(quick_action_target) + + next unless success + + @execution_message[:approve] = _('Approved the current merge request.') + end end def merge_orchestration_service |