Skip to content

Commit

Permalink
Fix: Disable Local/Public Timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Dec 16, 2022
1 parent d89f519 commit 2f93d5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/controllers/api/v1/timelines/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class Api::V1::Timelines::PublicController < Api::BaseController
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }

def show
return false if Setting.disable_public_timelines && !current_user.staff?
return false if !truthy_param?(:local) && Setting.disable_public_timelines && !current_user.staff?
return false if truthy_param?(:local) && Setting.disable_local_timeline && !current_user.staff?
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
end
Expand All @@ -18,7 +19,7 @@ def require_auth?
end

def disable_public_timelines?
Setting.disable_public_timelines
Setting.disable_public_timelines || Setting.disable_local_timeline
end

def load_statuses
Expand All @@ -41,7 +42,7 @@ def public_statuses
def public_feed
PublicFeed.new(
current_account,
local: ((!Setting.disable_local_timeline || current_user.staff?) && truthy_param?(:local)),
local: truthy_param?(:local),
remote: truthy_param?(:remote),
only_media: truthy_param?(:only_media),
allow_local_only: truthy_param?(:allow_local_only),
Expand Down

0 comments on commit 2f93d5a

Please sign in to comment.