diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-24 03:11:19 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-24 03:11:19 +0300 |
commit | 88a15b4e7826047d5303d7cfd7847ee53e5eba15 (patch) | |
tree | bb7ff2d7d1fdbe5e979d68536d3c8b5dd85a3b15 /app | |
parent | 2bb4ea854228c3c9660d5cb55f59e2cafd1f33ec (diff) | |
parent | 70fa9d5629f6a368da5d649450e3e575ca1c252a (diff) |
Merge branch 'merge-status-without-timestamps' into 'master'
Don't mark merge request as updated when merge status relative to target branch changes.
Addresses https://gitlab.com/gitlab-org/gitlab-ce/issues/1254 and private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2165.
See merge request !431
Diffstat (limited to 'app')
-rw-r--r-- | app/models/merge_request.rb | 9 | ||||
-rw-r--r-- | app/services/merge_requests/refresh_service.rb | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 798306f6dcc..5634f9a686e 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -105,6 +105,15 @@ class MergeRequest < ActiveRecord::Base state :unchecked state :can_be_merged state :cannot_be_merged + + around_transition do |merge_request, transition, block| + merge_request.record_timestamps = false + begin + block.call + ensure + merge_request.record_timestamps = true + end + end end validates :source_project, presence: true, unless: :allow_broken diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb index 7eef2c2d6a5..e9b526d1fb7 100644 --- a/app/services/merge_requests/refresh_service.rb +++ b/app/services/merge_requests/refresh_service.rb @@ -53,7 +53,7 @@ module MergeRequests if merge_request.source_branch == @branch_name || force_push? merge_request.reload_code - update_merge_request(merge_request) + merge_request.mark_as_unchecked else mr_commit_ids = merge_request.commits.map(&:id) push_commit_ids = @commits.map(&:id) @@ -61,20 +61,14 @@ module MergeRequests if matches.any? merge_request.reload_code - update_merge_request(merge_request) + merge_request.mark_as_unchecked else - update_merge_request(merge_request) + merge_request.mark_as_unchecked 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 |