mastodon/app/controllers/api/v2/statuses_controller.rb
2025-06-25 13:48:02 +02:00

24 lines
628 B
Ruby

# frozen_string_literal: true
class Api::V2::StatusesController < Api::BaseController
include Authorization
before_action -> { authorize_if_got_token! :read, :'read:statuses' }
before_action :set_status
def context
descendants_results = @status.descendants(current_account, limit: 3, depth: 2, after_id: nil)
@context = Context.new(ancestors: [], descendants: descendants_results)
render json: @context, serializer: REST::ContextSerializer
end
private
def set_status
@status = Status.find(params[:id])
authorize @status, :show?
rescue Mastodon::NotPermittedError
not_found
end
end