2017-07-15 11:01:39 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityPub::OutboxesController < Api::BaseController
|
2018-02-02 20:19:59 +11:00
|
|
|
include SignatureVerification
|
|
|
|
|
2017-07-15 11:01:39 +10:00
|
|
|
before_action :set_account
|
|
|
|
|
|
|
|
def show
|
2018-02-02 20:19:59 +11:00
|
|
|
@statuses = @account.statuses.permitted_for(@account, signed_request_account).paginate_by_max_id(20, params[:max_id], params[:since_id])
|
2017-07-15 11:01:39 +10:00
|
|
|
@statuses = cache_collection(@statuses, Status)
|
|
|
|
|
2018-03-04 19:19:11 +11:00
|
|
|
render json: outbox_presenter, serializer: ActivityPub::OutboxSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
2017-07-15 11:01:39 +10: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
|