Add a date limit on accounts-statusescontroller without auth

This commit is contained in:
Fosco Marotto 2021-01-23 04:27:48 -05:00
parent 940b6eb392
commit b33c16b131
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
return render json: { "error": true }, status: 429 return render json: { "error": true }, status: 429
end end
end end
@statuses = load_statuses @statuses = load_statuses
render json: @statuses, render json: @statuses,
each_serializer: REST::StatusSerializer, each_serializer: REST::StatusSerializer,
@ -39,6 +39,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
if current_account.nil? if current_account.nil?
statuses = statuses.limit(8) statuses = statuses.limit(8)
statuses = statuses.where("created_at > NOW() - INTERVAL '30 days'")
else else
statuses = statuses.paginate_by_id(limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id)) statuses = statuses.paginate_by_id(limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id))
end end

View File

@ -51,7 +51,6 @@ class Api::V1::StatusesController < Api::BaseController
def create def create
markdown = status_params[:markdown] unless status_params[:markdown] === status_params[:status] markdown = status_params[:markdown] unless status_params[:markdown] === status_params[:status]
@status = PostStatusService.new.call(current_user.account, @status = PostStatusService.new.call(current_user.account,
text: status_params[:status], text: status_params[:status],
markdown: markdown, markdown: markdown,