2017-07-14 21:01:39 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityPub::OutboxesController < Api::BaseController
|
2018-02-02 04:19:59 -05:00
|
|
|
include SignatureVerification
|
|
|
|
|
2017-07-14 21:01:39 -04:00
|
|
|
before_action :set_account
|
|
|
|
|
|
|
|
def show
|
2018-02-02 04:19:59 -05:00
|
|
|
@statuses = @account.statuses.permitted_for(@account, signed_request_account).paginate_by_max_id(20, params[:max_id], params[:since_id])
|
2017-07-14 21:01:39 -04:00
|
|
|
@statuses = cache_collection(@statuses, Status)
|
|
|
|
|
2017-08-13 22:16:43 -04:00
|
|
|
render json: outbox_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
2017-07-14 21:01:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_account
|
|
|
|
@account = Account.find_local!(params[:account_username])
|
|
|
|
end
|
|
|
|
|
|
|
|
def outbox_presenter
|
|
|
|
ActivityPub::CollectionPresenter.new(
|
|
|
|
id: account_outbox_url(@account),
|
|
|
|
type: :ordered,
|
|
|
|
size: @account.statuses_count,
|
|
|
|
items: @statuses
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|