Commit 5d2595da authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'cancel-auto-merge-when-merge-request-is-closed' into 'master'

Cancel auto merge when merge request is closed

See merge request gitlab-org/gitlab-ce!28782
parents 0b864208 9b91e681
......@@ -18,6 +18,7 @@ module MergeRequests
invalidate_cache_counts(merge_request, users: merge_request.assignees)
merge_request.update_project_counter_caches
cleanup_environments(merge_request)
cancel_auto_merge(merge_request)
end
merge_request
......@@ -33,5 +34,9 @@ module MergeRequests
merge_request_metrics_service(merge_request).close(close_event)
end
end
def cancel_auto_merge(merge_request)
AutoMergeService.new(project, current_user).cancel(merge_request)
end
end
end
---
title: Cancel auto merge when merge request is closed
merge_request: 28782
author:
type: fixed
......@@ -52,6 +52,14 @@ describe MergeRequests::CloseService do
it 'marks todos as done' do
expect(todo.reload).to be_done
end
context 'when auto merge is enabled' do
let(:merge_request) { create(:merge_request, :merge_when_pipeline_succeeds) }
it 'cancels the auto merge' do
expect(@merge_request).not_to be_auto_merge_enabled
end
end
end
it 'updates metrics' do
......
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