Merge pull request #705 from basecamp/flavorjones/fix-notifs-turbo-response
Broadcast when all notifications are cleared
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user