diff options
-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 |