From de7c3291e9e7d4a8f542c912c7575ec97a3a78df Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Thu, 20 Nov 2014 09:29:56 +0300 Subject: [PATCH] Trigger merge request hook when source updated --- app/services/merge_requests/refresh_service.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index baf0936cc3d..e557dd3ab07 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -51,7 +51,7 @@ module MergeRequests if merge_request.source_branch == @branch_name || force_push? merge_request.reload_code - merge_request.mark_as_unchecked + update_merge_request(merge_request) else mr_commit_ids = merge_request.commits.map(&:id) push_commit_ids = @commits.map(&:id) @@ -59,14 +59,20 @@ module MergeRequests if matches.any? merge_request.reload_code - merge_request.mark_as_unchecked + update_merge_request(merge_request) else - merge_request.mark_as_unchecked + update_merge_request(merge_request) end end end end + def update_merge_request(merge_request) + MergeRequests::UpdateService.new( + merge_request.target_project, + @current_user, merge_status: 'unchecked').execute(merge_request) + end + # Add comment about pushing new commits to merge requests def comment_mr_with_commits merge_requests = @project.origin_merge_requests.opened.where(source_branch: @branch_name).to_a