Files
fizzy/app/controllers/notifications_controller.rb
T
David Heinemeier Hansson d3c5c86b21 Style
2025-04-12 14:06:11 +02:00

20 lines
514 B
Ruby

class NotificationsController < ApplicationController
def index
if @page.first?
@unread = Current.user.notifications.unread.ordered
end
set_page_and_extract_portion_from Current.user.notifications.read.ordered
end
def mark_read
@notification = Current.user.notifications.find(params[:id])
@notification.update!(read_at: Time.current)
respond_to do |format|
format.html { redirect_back fallback_location: notifications_path }
format.turbo_stream
end
end
end