Reinstate card readings

This commit is contained in:
Stanko K.R.
2026-02-17 13:57:24 +01:00
parent 7ce88b5d7e
commit 9d4db14fc3
3 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -2,12 +2,12 @@ class Cards::ReadingsController < ApplicationController
include CardScoped include CardScoped
def create def create
@card.read_by(Current.user) @notification = @card.read_by(Current.user)
record_board_access record_board_access
end end
def destroy def destroy
@card.unread_by(Current.user) @notification = @card.unread_by(Current.user)
record_board_access record_board_access
end end
+2 -2
View File
@@ -2,11 +2,11 @@ module Card::Readable
extend ActiveSupport::Concern extend ActiveSupport::Concern
def read_by(user) def read_by(user)
user.notifications.find_by(card: self)&.read user.notifications.find_by(card: self)&.tap(&:read)
end end
def unread_by(user) def unread_by(user)
user.notifications.find_by(card: self)&.unread user.notifications.find_by(card: self)&.tap(&:unread)
end end
def remove_inaccessible_notifications def remove_inaccessible_notifications
@@ -0,0 +1 @@
<%= turbo_stream.remove @notification if @notification %>