0
0
Fork 0

Destroy NotificationRequests that are dismissed (#31008)

This commit is contained in:
David Roetzel 2024-07-12 14:09:52 +02:00 committed by GitHub
parent c929b4cace
commit 35a437a03f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 57 additions and 40 deletions

View file

@ -28,14 +28,14 @@ class Api::V1::Notifications::RequestsController < Api::BaseController
end
def dismiss
@request.update!(dismissed: true)
@request.destroy!
render_empty
end
private
def load_requests
requests = NotificationRequest.where(account: current_account).where(dismissed: truthy_param?(:dismissed) || false).includes(:last_status, from_account: [:account_stat, :user]).to_a_paginated_by_id(
requests = NotificationRequest.where(account: current_account).includes(:last_status, from_account: [:account_stat, :user]).to_a_paginated_by_id(
limit_param(DEFAULT_ACCOUNTS_LIMIT),
params_slice(:max_id, :since_id, :min_id)
)
@ -68,8 +68,4 @@ class Api::V1::Notifications::RequestsController < Api::BaseController
def pagination_since_id
@requests.first.id
end
def pagination_params(core_params)
params.slice(:dismissed).permit(:dismissed).merge(core_params)
end
end