diff options
author | ThibG <thib@sitedethib.com> | 2020-09-08 17:20:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-08 17:20:00 +0200 |
commit | 6e83020950ab81c6be6b3bfec92643f1b0d23ce6 (patch) | |
tree | ccd775be4b73170fcbf45407b84ad35fc37fb853 /app/controllers/api/v1/timelines/public_controller.rb | |
parent | 437d71bddf967573df3912ee5976f7c5a5a7b4c7 (diff) | |
parent | 9748f074a385fce5ad6913b1a22fb7ea9e7566db (diff) |
Merge pull request #1419 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api/v1/timelines/public_controller.rb')
-rw-r--r-- | app/controllers/api/v1/timelines/public_controller.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb index 52b5cb323..fbd99667c 100644 --- a/app/controllers/api/v1/timelines/public_controller.rb +++ b/app/controllers/api/v1/timelines/public_controller.rb @@ -20,28 +20,26 @@ class Api::V1::Timelines::PublicController < Api::BaseController end def cached_public_statuses_page - cache_collection_paginated_by_id( - public_statuses, - Status, - limit_param(DEFAULT_STATUSES_LIMIT), - params_slice(:max_id, :since_id, :min_id) - ) + cache_collection(public_statuses, Status) end def public_statuses - statuses = public_timeline_statuses - - statuses = statuses.not_local_only unless truthy_param?(:local) || truthy_param?(:allow_local_only) - - if truthy_param?(:only_media) - statuses.joins(:media_attachments).group(:id) - else - statuses - end + public_feed.get( + limit_param(DEFAULT_STATUSES_LIMIT), + params[:max_id], + params[:since_id], + params[:min_id] + ) end - def public_timeline_statuses - Status.as_public_timeline(current_account, truthy_param?(:remote) ? :remote : truthy_param?(:local)) + def public_feed + PublicFeed.new( + current_account, + local: truthy_param?(:local), + remote: truthy_param?(:remote), + only_media: truthy_param?(:only_media), + allow_local_only: truthy_param?(:allow_local_only) + ) end def insert_pagination_headers |