about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-01-08 18:33:43 +0100
committerThibaut Girka <thib@sitedethib.com>2020-07-06 21:12:06 +0200
commitd973e110616c132f1d8df676e7039a57b9134537 (patch)
tree58b8eb44fe1ab4cb9edea65b2cb6d404bcb83f22 /app/controllers/api
parent94e09d309cb068ea92919767e40e655260ac43cb (diff)
Add UI option to show local-only toots in public timeline
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/timelines/public_controller.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb
index c6e7854d9..2f9f88251 100644
--- a/app/controllers/api/v1/timelines/public_controller.rb
+++ b/app/controllers/api/v1/timelines/public_controller.rb
@@ -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