Commit f590f9ff authored by Sean McGivern's avatar Sean McGivern

Make issuables_count_for_state helper public

parent d54ed686
......@@ -173,6 +173,7 @@ module IssuablesHelper
html.html_safe
end
def cached_assigned_issuables_count(assignee, issuable_type, state)
cache_key = hexdigest(['assigned_issuables_count', assignee.id, issuable_type, state].join('-'))
Rails.cache.fetch(cache_key, expires_in: 2.minutes) do
......@@ -241,6 +242,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?
......@@ -259,18 +272,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
......
......@@ -12,7 +12,7 @@
.modal-header
= icon('check', { class: 'export-checkmark' })
%strong
#{pluralize(cached_issuables_count_for_state(:issues, params[:state]), 'issue')} selected
#{pluralize(issuables_count_for_state(:issues, params[:state]), 'issue')} selected
.modal-body
%div
The CSV export will be created in the background. Once finished, it will be sent to
......
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