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