Broadcast notification readings

so that the notification tray will be more consistent across open
browser tabs.
This commit is contained in:
Mike Dalessio
2025-05-08 10:40:10 -04:00
parent 38274941ba
commit 822ec5b5bb
+5
View File
@@ -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