Commit 715a0e41 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Revert "Merge branch 'sidebar-cache-updates' into 'master'"

This reverts commit dd406182, reversing
changes made to d5d24976.
parent 320da597
...@@ -269,13 +269,7 @@ class Issue < ActiveRecord::Base ...@@ -269,13 +269,7 @@ class Issue < ActiveRecord::Base
end end
end end
def update_project_counter_caches?
state_changed? || confidential_changed?
end
def update_project_counter_caches def update_project_counter_caches
return unless update_project_counter_caches?
Projects::OpenIssuesCountService.new(project).refresh_cache Projects::OpenIssuesCountService.new(project).refresh_cache
end end
......
...@@ -942,13 +942,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -942,13 +942,7 @@ class MergeRequest < ActiveRecord::Base
true true
end end
def update_project_counter_caches?
state_changed?
end
def update_project_counter_caches def update_project_counter_caches
return unless update_project_counter_caches?
Projects::OpenMergeRequestsCountService.new(target_project).refresh_cache Projects::OpenMergeRequestsCountService.new(target_project).refresh_cache
end end
......
---
title: Only update the sidebar count caches when needed
merge_request:
author:
type: other
...@@ -773,22 +773,4 @@ describe Issue do ...@@ -773,22 +773,4 @@ describe Issue do
expect(described_class.public_only).to eq([public_issue]) expect(described_class.public_only).to eq([public_issue])
end end
end end
describe '#update_project_counter_caches?' do
it 'returns true when the state changes' do
subject.state = 'closed'
expect(subject.update_project_counter_caches?).to eq(true)
end
it 'returns true when the confidential flag changes' do
subject.confidential = true
expect(subject.update_project_counter_caches?).to eq(true)
end
it 'returns false when the state or confidential flag did not change' do
expect(subject.update_project_counter_caches?).to eq(false)
end
end
end end
...@@ -1694,25 +1694,4 @@ describe MergeRequest do ...@@ -1694,25 +1694,4 @@ describe MergeRequest do
expect(subject.ref_fetched?).to be_falsey expect(subject.ref_fetched?).to be_falsey
end end
end end
describe 'removing a merge request' do
it 'refreshes the number of open merge requests of the target project' do
project = subject.target_project
expect { subject.destroy }
.to change { project.open_merge_requests_count }.from(1).to(0)
end
end
describe '#update_project_counter_caches?' do
it 'returns true when the state changes' do
subject.state = 'closed'
expect(subject.update_project_counter_caches?).to eq(true)
end
it 'returns false when the state did not change' do
expect(subject.update_project_counter_caches?).to eq(false)
end
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