Commit dfdd824d authored by Kerri Miller's avatar Kerri Miller

Extract #handle_target_branch_change method

parent e3e41e2c
...@@ -43,16 +43,7 @@ module MergeRequests ...@@ -43,16 +43,7 @@ module MergeRequests
todo_service.update_merge_request(merge_request, current_user, old_mentioned_users) todo_service.update_merge_request(merge_request, current_user, old_mentioned_users)
end end
if merge_request.previous_changes.include?('target_branch') handle_target_branch_change(merge_request)
create_branch_change_note(merge_request,
'target',
target_branch_was_deleted ? 'delete' : 'update',
merge_request.previous_changes['target_branch'].first,
merge_request.target_branch)
abort_auto_merge(merge_request, 'target branch was changed')
end
handle_assignees_change(merge_request, old_assignees) if merge_request.assignees != old_assignees handle_assignees_change(merge_request, old_assignees) if merge_request.assignees != old_assignees
handle_reviewers_change(merge_request, old_reviewers) if merge_request.reviewers != old_reviewers handle_reviewers_change(merge_request, old_reviewers) if merge_request.reviewers != old_reviewers
handle_milestone_change(merge_request) handle_milestone_change(merge_request)
...@@ -132,6 +123,20 @@ module MergeRequests ...@@ -132,6 +123,20 @@ module MergeRequests
) )
end end
def handle_target_branch_change(merge_request)
return unless merge_request.previous_changes.include?('target_branch')
create_branch_change_note(
merge_request,
'target',
target_branch_was_deleted ? 'delete' : 'update',
merge_request.previous_changes['target_branch'].first,
merge_request.target_branch
)
abort_auto_merge(merge_request, 'target branch was changed')
end
def handle_draft_status_change(merge_request, changed_fields) def handle_draft_status_change(merge_request, changed_fields)
return unless changed_fields.include?("title") return unless changed_fields.include?("title")
......
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