Commit e5cc197a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Split huge method MergeRequests::UpdateService#execute

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 23ed732e
...@@ -35,35 +35,38 @@ module MergeRequests ...@@ -35,35 +35,38 @@ module MergeRequests
) )
end end
if merge_request.previous_changes.include?('target_branch') handle_changes(merge_request)
create_branch_change_note(merge_request, 'target', merge_request.create_new_cross_references!(current_user)
merge_request.previous_changes['target_branch'].first, execute_hooks(merge_request, 'update')
merge_request.target_branch) end
end
if merge_request.previous_changes.include?('milestone_id') merge_request
create_milestone_note(merge_request) end
end
if merge_request.previous_changes.include?('assignee_id') def handle_changes(merge_request)
create_assignee_note(merge_request) if merge_request.previous_changes.include?('target_branch')
notification_service.reassigned_merge_request(merge_request, current_user) create_branch_change_note(merge_request, 'target',
end merge_request.previous_changes['target_branch'].first,
merge_request.target_branch)
end
if merge_request.previous_changes.include?('title') if merge_request.previous_changes.include?('milestone_id')
create_title_change_note(merge_request, merge_request.previous_changes['title'].first) create_milestone_note(merge_request)
end end
if merge_request.previous_changes.include?('target_branch') || if merge_request.previous_changes.include?('assignee_id')
merge_request.previous_changes.include?('source_branch') create_assignee_note(merge_request)
merge_request.mark_as_unchecked notification_service.reassigned_merge_request(merge_request, current_user)
end end
merge_request.create_new_cross_references!(current_user) if merge_request.previous_changes.include?('title')
execute_hooks(merge_request, 'update') create_title_change_note(merge_request, merge_request.previous_changes['title'].first)
end end
merge_request if merge_request.previous_changes.include?('target_branch') ||
merge_request.previous_changes.include?('source_branch')
merge_request.mark_as_unchecked
end
end end
end end
end end
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