Commit 0b69b711 authored by Stan Hu's avatar Stan Hu

Make rebase from quick actions async

Also move rebase functionality into `MergeRequests::UpdateService` to
ensure merges/rebases are handled in the same location.
parent 69b88a0e
......@@ -127,14 +127,22 @@ module MergeRequests
def handle_quick_actions(merge_request)
super
# Ignore /merge if /rebase is used to avoid an unexpected race
params.delete(:merge) if params[:rebase] && params[:merge]
# Rebase is handled in MergeRequestActions to provide user feedback
params.delete(:rebase)
# Ensure this parameter gets used as an attribute
rebase = params.delete(:rebase)
if rebase
rebase_from_quick_action(merge_request)
# Ignore /merge if /rebase is used to avoid an unexpected race
params.delete(:merge)
end
merge_from_quick_action(merge_request) if params[:merge]
end
def rebase_from_quick_action(merge_request)
merge_request.rebase_async(current_user.id)
end
def merge_from_quick_action(merge_request)
last_diff_sha = params.delete(:merge)
......
......@@ -59,17 +59,9 @@ module Gitlab
# This will be used to avoid simultaneous /merge and /rebase actions
@updates[:rebase] = true
result = MergeRequests::RebaseService.new(quick_action_target.project, current_user)
.execute(quick_action_target)
branch = quick_action_target.source_branch
@execution_message[:rebase] =
if result[:status] == :success
_('Scheduled a rebase of branch %{branch}.')
else
_('Failed to schedule a rebase of %{branch}.')
end % { branch: branch }
@execution_message[:rebase] = _('Scheduled a rebase of branch %{branch}.') % { branch: branch }
end
desc 'Toggle the Draft status'
......
......@@ -11880,9 +11880,6 @@ msgstr ""
msgid "Failed to save preferences."
msgstr ""
msgid "Failed to schedule a rebase of %{branch}."
msgstr ""
msgid "Failed to set due date because the date format is invalid."
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment