diff options
author | Sean McGivern <sean@gitlab.com> | 2017-07-11 15:19:43 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-07-19 12:21:18 +0300 |
commit | c57ae83dcfaeff9c358b5f896202e04a86ad6ef3 (patch) | |
tree | 183f7f8c2b37a760964afcb939f1db9cd20c59f8 /app/finders | |
parent | 11f9ac0a48b62cef25eedede4c1819964f08d5ce (diff) |
Fix issuable state counter cache keys
These cache a hash of counts by state, so the state isn't needed in the key
itself.
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 9 | ||||
-rw-r--r-- | app/finders/issues_finder.rb | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 2e5a6493134..1585c11ab3a 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -20,7 +20,7 @@ # class IssuableFinder include CreatedAtFilter - + NONE = '0'.freeze IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page].freeze @@ -89,8 +89,8 @@ class IssuableFinder execute.find_by!(*params) end - def state_counter_cache_key(state) - Digest::SHA1.hexdigest(state_counter_cache_key_components(state).flatten.join('-')) + def state_counter_cache_key + Digest::SHA1.hexdigest(state_counter_cache_key_components.flatten.join('-')) end def group @@ -417,9 +417,8 @@ class IssuableFinder params[:scope] == 'created-by-me' || params[:scope] == 'authored' || params[:scope] == 'assigned-to-me' end - def state_counter_cache_key_components(state) + def state_counter_cache_key_components opts = params.with_indifferent_access - opts[:state] = state opts.except!(*IRRELEVANT_PARAMS_FOR_CACHE_KEY) opts.delete_if { |_, value| value.blank? } diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index 85230ff1293..295a64ef5b8 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -75,7 +75,7 @@ class IssuesFinder < IssuableFinder current_user.blank? || for_counting || params[:for_counting] end - def state_counter_cache_key_components(state) + def state_counter_cache_key_components extra_components = [ user_can_see_all_confidential_issues?, user_cannot_see_confidential_issues?(for_counting: true) |