Update notifications_controller.rb

This commit is contained in:
Muhsin Keloth
2023-12-14 19:30:16 +05:30
parent 1906c0ff63
commit ce339d0350
@@ -4,6 +4,7 @@ class Api::V1::Accounts::NotificationsController < Api::V1::Accounts::BaseContro
before_action :fetch_notification, only: [:update, :destroy, :snooze]
before_action :set_primary_actor, only: [:read_all]
before_action :set_current_page, only: [:index]
def index
@unread_count = current_user.notifications.where(account_id: current_account.id, read_at: nil).count
@@ -56,6 +57,10 @@ class Api::V1::Accounts::NotificationsController < Api::V1::Accounts::BaseContro
@notification = current_user.notifications.find(params[:id])
end
def set_current_page
@current_page = params[:page] || 1
end
def notification_finder
@notification_finder ||= NotificationFinder.new(Current.user, Current.account, params)
end