app/controllers/tramway/admin/application_controller.rb in tramway-admin-1.20 vs app/controllers/tramway/admin/application_controller.rb in tramway-admin-1.20.1
- old
+ new
@@ -30,11 +30,11 @@
end
def collections_counts
@counts = decorator_class.collections.reduce({}) do |hash, collection|
records = model_class.active.send(collection)
- records = records.send "#{current_user.role}_scope", current_user.id unless current_user.role.admin?
+ records = records.send "#{current_user.role}_scope", current_user.id
hash.merge! collection => records.count
end
end
def application
@@ -42,10 +42,12 @@
@application = Tramway::Core.application&.model_class&.first || Tramway::Core.application
end
end
def notifications
- @notifications ||= Tramway::Admin.notifications
+ @notifications ||= Tramway::Admin.notificable_queries&.reduce({}) do |hash, notification|
+ hash.merge! notification[0] => notification[1].call(current_user)
+ end
@notifications
end
def notifications_count
@notifications_count = notifications.reduce(0) do |count, notification|