Commit f3b033c7 authored by Kerri Miller's avatar Kerri Miller

Extract fallback update routine to pvt method

parent 04122f32
......@@ -11,22 +11,7 @@ module MergeRequests
end
def execute(merge_request)
updated_merge_request = update_merge_request_with_specialized_service(merge_request)
return updated_merge_request unless updated_merge_request.nil?
# We don't allow change of source/target projects and source branch
# after merge request was created
params.delete(:source_project_id)
params.delete(:target_project_id)
params.delete(:source_branch)
if merge_request.closed_or_merged_without_fork?
params.delete(:target_branch)
params.delete(:force_remove_source_branch)
end
update_task_event(merge_request) || update(merge_request)
update_merge_request_with_specialized_service(merge_request) || general_fallback(merge_request)
end
def handle_changes(merge_request, options)
......@@ -90,6 +75,21 @@ module MergeRequests
attr_reader :target_branch_was_deleted
def general_fallback(merge_request)
# We don't allow change of source/target projects and source branch
# after merge request was created
params.delete(:source_project_id)
params.delete(:target_project_id)
params.delete(:source_branch)
if merge_request.closed_or_merged_without_fork?
params.delete(:target_branch)
params.delete(:force_remove_source_branch)
end
update_task_event(merge_request) || update(merge_request)
end
def track_title_and_desc_edits(changed_fields)
tracked_fields = %w(title description)
......
......@@ -5,12 +5,10 @@ module EE
module UpdateService
extend ::Gitlab::Utils::Override
override :execute
def execute(merge_request)
updated_merge_request = update_merge_request_with_specialized_service(merge_request)
return updated_merge_request unless updated_merge_request.nil?
private
override :general_fallback
def general_fallback(merge_request)
unless update_task_event?
old_approvers = merge_request.overall_approvers(exclude_code_owners: true)
end
......@@ -37,8 +35,6 @@ module EE
merge_request
end
private
override :after_update
def after_update(merge_request)
super
......
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