feat: Snooze notification API (#8439)

This commit is contained in:
Muhsin Keloth
2023-12-04 12:32:35 +05:30
committed by GitHub
parent aad18e1ca4
commit 449503bb94
6 changed files with 46 additions and 2 deletions

View File

@@ -1,7 +1,8 @@
class Api::V1::Accounts::NotificationsController < Api::V1::Accounts::BaseController
RESULTS_PER_PAGE = 15
include DateRangeHelper
before_action :fetch_notification, only: [:update, :destroy]
before_action :fetch_notification, only: [:update, :destroy, :snooze]
before_action :set_primary_actor, only: [:read_all]
before_action :set_current_page, only: [:index]
@@ -38,6 +39,11 @@ class Api::V1::Accounts::NotificationsController < Api::V1::Accounts::BaseContro
render json: @unread_count
end
def snooze
@notification.update(snoozed_until: parse_date_time(params[:snoozed_until].to_s)) if params[:snoozed_until]
render json: @notification
end
private
def set_primary_actor

View File

@@ -7,6 +7,7 @@
# primary_actor_type :string not null
# read_at :datetime
# secondary_actor_type :string
# snoozed_until :datetime
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint not null