diff options
author | Sean McGivern <sean@gitlab.com> | 2017-06-30 11:55:27 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-06-30 11:55:27 +0100 |
commit | 4bd17d4f7427b2f5f950e601d1a21042b30f69b1 (patch) | |
tree | e2d9d605a551a6f27cedd777b2eb74622fe6456c /app/helpers | |
parent | cb30edfae5c3557686463ca22eca7ef572c3ac33 (diff) | |
download | gitlab-ce-4bd17d4f7427b2f5f950e601d1a21042b30f69b1.tar.gz |
Make issuables_count_for_state publicspeed-up-issue-counting-for-a-project
This doesn't need to be public in CE, but EE uses it as such.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/issuables_helper.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 5385ada6dc4..05177e58c5a 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -233,6 +233,18 @@ module IssuablesHelper } end + def issuables_count_for_state(issuable_type, state, finder: nil) + finder ||= public_send("#{issuable_type}_finder") + cache_key = finder.state_counter_cache_key(state) + + @counts ||= {} + @counts[cache_key] ||= Rails.cache.fetch(cache_key, expires_in: 2.minutes) do + finder.count_by_state + end + + @counts[cache_key][state] + end + private def sidebar_gutter_collapsed? @@ -251,18 +263,6 @@ module IssuablesHelper end end - def issuables_count_for_state(issuable_type, state, finder: nil) - finder ||= public_send("#{issuable_type}_finder") - cache_key = finder.state_counter_cache_key(state) - - @counts ||= {} - @counts[cache_key] ||= Rails.cache.fetch(cache_key, expires_in: 2.minutes) do - finder.count_by_state - end - - @counts[cache_key][state] - end - def issuable_templates(issuable) @issuable_templates ||= case issuable |