Files
fizzy/app/controllers/readings_controller.rb
T
Kevin McConnell b8ecfa0125 Replace notifications on read, instead of removing
Previously when a notification was read, we'd remove it from the list.
This will often be fine, but if there were more unread notifications
that hadn't been loaded yet (because there were too many for the initial
page) then the list could become empty when really there are still more
items to show.

So instead of removing the items when they're read, we can reload the
list with the new page of items. This should allow the older
notifications to come into view when necessary.
2025-01-14 14:23:46 +00:00

14 lines
351 B
Ruby

class ReadingsController < ApplicationController
include BubbleScoped, BucketScoped
def create
mark_bubble_notifications_read
@notifications = Current.user.notifications.unread.ordered.limit(20)
end
private
def mark_bubble_notifications_read
Current.user.notifications.where(bubble: @bubble).update(read: true)
end
end