BigW Consortium Gitlab

Commit 23a8a91a by Robert Speicher Committed by Robert Speicher

Merge branch 'fix-mr-sidebar-counter-after-merge' into 'master'

Clear merge requests counter cache after merge Closes gitlab-ee#3573 and #38344 See merge request gitlab-org/gitlab-ce!14563
parent 06a5a331
......@@ -14,6 +14,7 @@ module MergeRequests
notification_service.merge_mr(merge_request, current_user)
execute_hooks(merge_request, 'merge')
invalidate_cache_counts(merge_request, users: merge_request.assignees)
merge_request.update_project_counter_caches
end
private
......
---
title: Fix merge request counter updates after merge
merge_request:
author:
type: fixed
......@@ -11,5 +11,16 @@ describe MergeRequests::PostMergeService do
describe '#execute' do
it_behaves_like 'cache counters invalidator'
it 'refreshes the number of open merge requests for a valid MR', :use_clean_rails_memory_store_caching do
# Cache the counter before the MR changed state.
project.open_merge_requests_count
merge_request.update!(state: 'merged')
service = described_class.new(project, user, {})
expect { service.execute(merge_request) }
.to change { project.open_merge_requests_count }.from(1).to(0)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment