Commit bffe0d63 authored by Josh Frye's avatar Josh Frye

Cache assigned merge request count. Closes #18036

parent f828b744
......@@ -776,6 +776,12 @@ class User < ActiveRecord::Base
notification_settings.find_or_initialize_by(source: source)
end
def assigned_open_merge_request_count
Rails.cache.fetch(['users', id, 'assigned_open_merge_request_count'], expires_in: 60) do
assigned_merge_requests.opened.count
end
end
private
def projects_union
......
......@@ -36,7 +36,7 @@
= icon('tasks fw')
%span
Merge Requests
%span.count= number_with_delimiter(current_user.assigned_merge_requests.opened.count)
%span.count= number_with_delimiter(current_user.assigned_open_merge_request_count)
= nav_link(controller: :snippets) do
= link_to dashboard_snippets_path, title: 'Snippets' do
= icon('clipboard fw')
......
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