Commit 3c40c98e authored by Luke Duncalfe's avatar Luke Duncalfe
parent e73f537c
...@@ -264,8 +264,10 @@ module API ...@@ -264,8 +264,10 @@ module API
PostReceive.perform_async(params[:gl_repository], params[:identifier], PostReceive.perform_async(params[:gl_repository], params[:identifier],
params[:changes], push_options.as_json) params[:changes], push_options.as_json)
if Feature.enabled?(:mr_push_options, default_enabled: true)
mr_options = push_options.get(:merge_request) mr_options = push_options.get(:merge_request)
output.merge!(process_mr_push_options(mr_options, project, user, params[:changes])) if mr_options.present? output.merge!(process_mr_push_options(mr_options, project, user, params[:changes])) if mr_options.present?
end
broadcast_message = BroadcastMessage.current&.last&.message broadcast_message = BroadcastMessage.current&.last&.message
reference_counter_decreased = Gitlab::ReferenceCounter.new(params[:gl_repository]).decrease reference_counter_decreased = Gitlab::ReferenceCounter.new(params[:gl_repository]).decrease
......
...@@ -995,6 +995,20 @@ describe API::Internal do ...@@ -995,6 +995,20 @@ describe API::Internal do
expect(json_response['warnings']).to eq('Error encountered with push options \'merge_request.create\': my error') expect(json_response['warnings']).to eq('Error encountered with push options \'merge_request.create\': my error')
end end
context 'when the feature is disabled' do
it 'does not invoke MergeRequests::PushOptionsHandlerService' do
Feature.disable(:mr_push_options)
expect(MergeRequests::PushOptionsHandlerService).to receive(:new)
expect do
post api('/internal/post_receive'), params: valid_params
end.not_to change { MergeRequest.count }
Feature.enable(:mr_push_options)
end
end
end end
context 'broadcast message exists' do context 'broadcast message exists' 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