闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
782 B

  1. # frozen_string_literal: true
  2. class ActivityPub::OutboxesController < Api::BaseController
  3. before_action :set_account
  4. def show
  5. @statuses = @account.statuses.permitted_for(@account, current_account).paginate_by_max_id(20, params[:max_id], params[:since_id])
  6. @statuses = cache_collection(@statuses, Status)
  7. render json: outbox_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
  8. end
  9. private
  10. def set_account
  11. @account = Account.find_local!(params[:account_username])
  12. end
  13. def outbox_presenter
  14. ActivityPub::CollectionPresenter.new(
  15. id: account_outbox_url(@account),
  16. type: :ordered,
  17. size: @account.statuses_count,
  18. items: @statuses
  19. )
  20. end
  21. end