diff --git a/app/controllers/notifications/readings_controller.rb b/app/controllers/notifications/readings_controller.rb index 5f593fa95..805bb1a67 100644 --- a/app/controllers/notifications/readings_controller.rb +++ b/app/controllers/notifications/readings_controller.rb @@ -6,6 +6,9 @@ class Notifications::ReadingsController < ApplicationController def create_all Current.user.notifications.unread.read_all - redirect_to notifications_path + respond_to do |format| + format.html { redirect_to notifications_path } + format.turbo_stream { } # No action needed, readings will have been broadcast + end end end diff --git a/app/models/notification.rb b/app/models/notification.rb index 6ae1b91bf..73525f4ff 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -13,7 +13,7 @@ class Notification < ApplicationRecord delegate :card, to: :source def self.read_all - update!(read_at: Time.current) + all.each { |notification| notification.read } end def read