diff options
Diffstat (limited to 'app/controllers/profiles/notifications_controller.rb')
-rw-r--r-- | app/controllers/profiles/notifications_controller.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 57e5ca4d55a..abb6e46394e 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -45,11 +45,17 @@ class Profiles::NotificationsController < Profiles::ApplicationController projects = project_notifications.map(&:source) ActiveRecord::Associations::Preloader.new( records: projects, - associations: { namespace: [:route, :owner], group: [], creator: [], project_setting: [] } + associations: project_associations ).call Preloaders::UserMaxAccessLevelInProjectsPreloader.new(projects, current_user).execute project_notifications.select { |notification| current_user.can?(:read_project, notification.source) } end # rubocop: enable CodeReuse/ActiveRecord + + def project_associations + { namespace: [:route, :owner], group: [], creator: [], project_setting: [] } + end end + +Profiles::NotificationsController.prepend_mod |