Class: NewsmastMastodon::Api::V1::Timelines::FeedsController

Inherits:
Api::V1::Timelines::BaseController
  • Object
show all
Defined in:
app/controllers/newsmast_mastodon/api/v1/timelines/feeds_controller.rb

Constant Summary collapse

PERMITTED_PARAMS =
%i(local remote limit only_media).freeze

Instance Method Summary collapse

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/newsmast_mastodon/api/v1/timelines/feeds_controller.rb', line 7

def show
  @statuses = []
  username = params[:username]
  return render json: { error: "Username is required" }, status: :bad_request unless username.present?

   = Account.find_by(username: username)
  return render json: { error: "Account not found" }, status: :not_found unless .present?

  unless Object.const_defined?('ContentFilters::CommunityAdmin') && ContentFilters::CommunityAdmin.exists?(
      is_boost_bot: true, 
      account_id: .id, 
      account_status: ContentFilters::CommunityAdmin.[:active])
      return render json: { error: "Account is not a community admin" }, status: :not_found
  end

  cache_if_unauthenticated!
  @statuses = load_statuses
  render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.)
end