Commit 677af1dd authored by Lucas Deschamps's avatar Lucas Deschamps

Improve changes after MR review.

parent 8c3e6987
......@@ -142,7 +142,7 @@ module IssuablesHelper
end
def cached_assigned_issuables_count(assignee, issuable_type, state)
cache_key = "#{assignee.id}_#{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
assigned_issuables_count(assignee, issuable_type, state)
end
......@@ -151,7 +151,7 @@ module IssuablesHelper
private
def assigned_issuables_count(assignee, issuable_type, state)
assignee.send("assigned_#{issuable_type}").send(state).count
assignee.public_send("assigned_#{issuable_type}").public_send(state).count
end
def sidebar_gutter_collapsed?
......
---
title: Navigation bar issuables counters reflects dashboard issuables counters
merge_request:
merge_request: 7368
author: Lucas Deschamps
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Navigation bar counter', feature: true, js: true, caching: true do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
let(:project) { create(:empty_project, namespace: user.namespace) }
before do
login_as(user)
......
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