diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-18 00:09:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-18 00:09:20 +0300 |
commit | 3e20234984524c3ccfb09eace7b9d170cbcc32d7 (patch) | |
tree | 5586f86210db467613ba99040c96b617066de8c9 /lib/gitlab/quick_actions | |
parent | 9a1066298169f8ebecacb9e55fe895f4f8962000 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r-- | lib/gitlab/quick_actions/merge_request_actions.rb | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/lib/gitlab/quick_actions/merge_request_actions.rb b/lib/gitlab/quick_actions/merge_request_actions.rb index 6137e257837..167e7ad67a9 100644 --- a/lib/gitlab/quick_actions/merge_request_actions.rb +++ b/lib/gitlab/quick_actions/merge_request_actions.rb @@ -88,11 +88,11 @@ module Gitlab @execution_message[:rebase] = _('Scheduled a rebase of branch %{branch}.') % { branch: branch } end - desc 'Toggle the Draft status' + desc { _('Toggle the Draft status') } explanation do noun = quick_action_target.to_ability_name.humanize(capitalize: false) if quick_action_target.draft? - _("Unmarks this %{noun} as a draft.") + _("Marks this %{noun} as ready.") else _("Marks this %{noun} as a draft.") end % { noun: noun } @@ -100,7 +100,7 @@ module Gitlab execution_message do noun = quick_action_target.to_ability_name.humanize(capitalize: false) if quick_action_target.draft? - _("Unmarked this %{noun} as a draft.") + _("Marked this %{noun} as ready.") else _("Marked this %{noun} as a draft.") end % { noun: noun } @@ -117,6 +117,35 @@ module Gitlab @updates[:wip_event] = quick_action_target.draft? ? 'ready' : 'draft' end + desc { _('Set the Ready status') } + explanation do + noun = quick_action_target.to_ability_name.humanize(capitalize: false) + if quick_action_target.draft? + _("Marks this %{noun} as ready.") + else + _("No change to this %{noun}'s draft status.") + end % { noun: noun } + end + execution_message do + noun = quick_action_target.to_ability_name.humanize(capitalize: false) + if quick_action_target.draft? + _("Marked this %{noun} as ready.") + else + _("No change to this %{noun}'s draft status.") + end % { noun: noun } + end + + types MergeRequest + condition do + # Allow it to mark as draft on MR creation page or through MR notes + # + quick_action_target.respond_to?(:draft?) && + (quick_action_target.new_record? || current_user.can?(:"update_#{quick_action_target.to_ability_name}", quick_action_target)) + end + command :ready do + @updates[:wip_event] = 'ready' if quick_action_target.draft? + end + desc { _('Set target branch') } explanation do |branch_name| _('Sets target branch to %{branch_name}.') % { branch_name: branch_name } |