Files
fizzy/app/controllers/notifications_controller.rb
T
2025-04-14 09:23:57 -05:00

20 lines
514 B
Ruby

class NotificationsController < ApplicationController
def index
set_page_and_extract_portion_from Current.user.notifications.read.ordered
if @page.first?
@unread = Current.user.notifications.unread.ordered
end
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