logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

outboxes_controller.rb (818B)


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