Files
fizzy/app/controllers/notifications_controller.rb
T
Jorge Manrubia 42a39b224c Cap the max number of unread notifications to 500
Simpler than adding 2 levels of pagination here
2025-11-21 15:55:24 +01:00

14 lines
473 B
Ruby

class NotificationsController < ApplicationController
MAX_UNREAD_NOTIFICATIONS = 500
def index
@unread = Current.user.notifications.unread.ordered.preloaded.limit(MAX_UNREAD_NOTIFICATIONS) unless current_page_param
set_page_and_extract_portion_from Current.user.notifications.read.ordered.preloaded
respond_to do |format|
format.turbo_stream if current_page_param # Allows read-all action to side step pagination
format.html
end
end
end