Feature flag for merge requestion push options
https://gitlab.com/gitlab-org/gitlab-ce/issues/43263 https://gitlab.com/gitlab-org/gitlab-ce/issues/53198
This commit is contained in:
parent
e73f537cb5
commit
3c40c98e26
|
@ -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)
|
||||||
|
|
||||||
mr_options = push_options.get(:merge_request)
|
if Feature.enabled?(:mr_push_options, default_enabled: true)
|
||||||
output.merge!(process_mr_push_options(mr_options, project, user, params[:changes])) if mr_options.present?
|
mr_options = push_options.get(:merge_request)
|
||||||
|
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
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue