2020-03-06 16:07:59 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module MergeRequests
|
|
|
|
class AfterCreateService < MergeRequests::BaseService
|
|
|
|
def execute(merge_request)
|
2021-03-09 13:09:41 -05:00
|
|
|
prepare_merge_request(merge_request)
|
|
|
|
merge_request.mark_as_unchecked if merge_request.preparing?
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def prepare_merge_request(merge_request)
|
2020-03-06 16:07:59 -05:00
|
|
|
event_service.open_mr(merge_request, current_user)
|
2021-03-05 10:09:12 -05:00
|
|
|
|
2021-01-07 13:10:38 -05:00
|
|
|
merge_request_activity_counter.track_create_mr_action(user: current_user)
|
2021-03-05 10:09:12 -05:00
|
|
|
merge_request_activity_counter.track_mr_including_ci_config(user: current_user, merge_request: merge_request)
|
|
|
|
|
2020-03-06 16:07:59 -05:00
|
|
|
notification_service.new_merge_request(merge_request, current_user)
|
|
|
|
|
2020-03-27 08:07:43 -04:00
|
|
|
create_pipeline_for(merge_request, current_user)
|
|
|
|
merge_request.update_head_pipeline
|
2020-03-06 16:07:59 -05:00
|
|
|
|
|
|
|
merge_request.diffs(include_stats: false).write_cache
|
|
|
|
merge_request.create_cross_references!(current_user)
|
2020-12-07 10:09:49 -05:00
|
|
|
|
2021-01-11 07:10:41 -05:00
|
|
|
OnboardingProgressService.new(merge_request.target_project.namespace).execute(action: :merge_request_created)
|
2020-03-06 16:07:59 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-08-19 17:10:32 -04:00
|
|
|
|
|
|
|
MergeRequests::AfterCreateService.prepend_if_ee('EE::MergeRequests::AfterCreateService')
|