Merge pull request #1372 from ThibG/glitch-soc/fixes/local-only-public-option

Add option to show local-only toots in public timeline
This commit is contained in:
ThibG
2020-07-07 19:58:12 +02:00
committed by GitHub
8 changed files with 43 additions and 24 deletions

View File

@@ -29,6 +29,8 @@ class Api::V1::Timelines::PublicController < Api::BaseController
params_slice(:max_id, :since_id, :min_id)
)
statuses = statuses.not_local_only unless truthy_param?(:allow_local_only)
if truthy_param?(:only_media)
# `SELECT DISTINCT id, updated_at` is too slow, so pluck ids at first, and then select id, updated_at with ids.
status_ids = statuses.joins(:media_attachments).distinct(:id).pluck(:id)
@@ -47,7 +49,7 @@ class Api::V1::Timelines::PublicController < Api::BaseController
end
def pagination_params(core_params)
params.slice(:local, :remote, :limit, :only_media).permit(:local, :remote, :limit, :only_media).merge(core_params)
params.slice(:local, :remote, :limit, :only_media, :allow_local_only).permit(:local, :remote, :limit, :only_media, :allow_local_only).merge(core_params)
end
def next_path