Reinstate card readings
This commit is contained in:
@@ -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,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 %>
|
||||||
Reference in New Issue
Block a user