diff --git a/app/controllers/cards/readings_controller.rb b/app/controllers/cards/readings_controller.rb index 1fc675b84..75fdbac19 100644 --- a/app/controllers/cards/readings_controller.rb +++ b/app/controllers/cards/readings_controller.rb @@ -2,12 +2,12 @@ class Cards::ReadingsController < ApplicationController include CardScoped def create - @card.read_by(Current.user) + @notification = @card.read_by(Current.user) record_board_access end def destroy - @card.unread_by(Current.user) + @notification = @card.unread_by(Current.user) record_board_access end diff --git a/app/models/card/readable.rb b/app/models/card/readable.rb index 0168f00a9..aec8c18dd 100644 --- a/app/models/card/readable.rb +++ b/app/models/card/readable.rb @@ -2,11 +2,11 @@ module Card::Readable extend ActiveSupport::Concern def read_by(user) - user.notifications.find_by(card: self)&.read + user.notifications.find_by(card: self)&.tap(&:read) end def unread_by(user) - user.notifications.find_by(card: self)&.unread + user.notifications.find_by(card: self)&.tap(&:unread) end def remove_inaccessible_notifications diff --git a/app/views/cards/readings/create.turbo_stream.erb b/app/views/cards/readings/create.turbo_stream.erb new file mode 100644 index 000000000..ebfcee900 --- /dev/null +++ b/app/views/cards/readings/create.turbo_stream.erb @@ -0,0 +1 @@ +<%= turbo_stream.remove @notification if @notification %>