Files
fizzy/app/controllers/cards/readings_controller.rb
T
Kevin McConnell 6c8fe164b3 Read a card should dismiss all notifications
Previous code assumed that there was a single notification to dismiss
for that card, but in practice there can be zero or many. If it's zero,
we need to avoid the crash. If it's many, we should dismiss them all.

Also re-rendering the notification stack after dismissing enables us to
remove all the removed cards, as well as reveal any older ones that were
previously outside the visible page size.

This reverts commit 6135909b7e.
2025-04-17 09:40:59 +01:00

9 lines
240 B
Ruby

class Cards::ReadingsController < ApplicationController
include CardScoped
def create
Current.user.notifications.unread.where(card: @card).read_all
@notifications = Current.user.notifications.unread.ordered.limit(20)
end
end