From 822ec5b5bb2eb31c0f3be8921de6c021b25e394b Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 8 May 2025 10:40:10 -0400 Subject: [PATCH] Broadcast notification readings so that the notification tray will be more consistent across open browser tabs. --- app/models/notification.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/notification.rb b/app/models/notification.rb index 01444ce61..c6bc43a2e 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -17,6 +17,7 @@ class Notification < ApplicationRecord def read update!(read_at: Time.current) + broadcast_read end def read? @@ -27,4 +28,8 @@ class Notification < ApplicationRecord def broadcast_unread broadcast_prepend_later_to user, :notifications, target: "notifications" end + + def broadcast_read + broadcast_remove_to user, :notifications + end end