From b33c16b13177a4693f1259effb7c672253c409ca Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Sat, 23 Jan 2021 04:27:48 -0500 Subject: [PATCH] Add a date limit on accounts-statusescontroller without auth --- app/controllers/api/v1/accounts/statuses_controller.rb | 3 ++- app/controllers/api/v1/statuses_controller.rb | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index 4ad9e929..32ef09d2 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -12,7 +12,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController return render json: { "error": true }, status: 429 end end - + @statuses = load_statuses render json: @statuses, each_serializer: REST::StatusSerializer, @@ -39,6 +39,7 @@ class Api::V1::Accounts::StatusesController < Api::BaseController if current_account.nil? statuses = statuses.limit(8) + statuses = statuses.where("created_at > NOW() - INTERVAL '30 days'") else statuses = statuses.paginate_by_id(limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id)) end diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index a9db3ab0..82dc7f5f 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -51,7 +51,6 @@ class Api::V1::StatusesController < Api::BaseController def create markdown = status_params[:markdown] unless status_params[:markdown] === status_params[:status] - @status = PostStatusService.new.call(current_user.account, text: status_params[:status], markdown: markdown,