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