diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | app/views/layouts/nav/_dashboard.html.haml | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 15b6cbc2255..8dde01bf355 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 43532b0c155..e14ae850fcc 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -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') |