diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-01-07 13:37:33 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-01-07 13:37:33 +0000 |
commit | cd11ede9ccdb05ff3e91bb4507af1ff063722608 (patch) | |
tree | fd27408bfa0afc1c11e7b6f34496815304291572 /app/services | |
parent | 75e6561684415b2fffb47a6293ba787c379b84b7 (diff) | |
parent | 4ab0b33db6f328fc68394fd3af992052f883401e (diff) | |
download | gitlab-ce-cd11ede9ccdb05ff3e91bb4507af1ff063722608.tar.gz |
Merge branch 'user-update-head-pipeline-worker-2' into 'master'
Refactor the logic of updating head pipelines for merge requests
See merge request gitlab-org/gitlab-ce!23502
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/merge_requests/create_service.rb | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb index 7bb9fa60515..02c2388c05c 100644 --- a/app/services/merge_requests/create_service.rb +++ b/app/services/merge_requests/create_service.rb @@ -26,7 +26,7 @@ module MergeRequests todo_service.new_merge_request(issuable, current_user) issuable.cache_merge_request_closes_issues!(current_user) create_merge_request_pipeline(issuable, current_user) - update_merge_requests_head_pipeline(issuable) + issuable.update_head_pipeline super end @@ -45,20 +45,6 @@ module MergeRequests private - def update_merge_requests_head_pipeline(merge_request) - pipeline = head_pipeline_for(merge_request) - merge_request.update(head_pipeline_id: pipeline.id) if pipeline - end - - def head_pipeline_for(merge_request) - return unless merge_request.source_project - - sha = merge_request.source_branch_sha - return unless sha - - merge_request.all_pipelines(shas: sha).first - end - def set_projects! # @project is used to determine whether the user can set the merge request's # assignee, milestone and labels. Whether they can depends on their |