def outbox_presenter
if page_requested?
ActivityPub::CollectionPresenter.new(
- id: account_outbox_url(@account, page_params),
+ id: outbox_url(page_params),
type: :ordered,
- part_of: account_outbox_url(@account),
+ part_of: outbox_url,
prev: prev_page,
next: next_page,
items: @statuses
id: account_outbox_url(@account),
type: :ordered,
size: @account.statuses_count,
- first: account_outbox_url(@account, page: true),
- last: account_outbox_url(@account, page: true, min_id: 0)
+ first: outbox_url(page: true),
+ last: outbox_url(page: true, min_id: 0)
)
end
end
+ def outbox_url(**kwargs)
+ if params[:account_username].present?
+ account_outbox_url(@account, **kwargs)
+ else
+ instance_actor_outbox_url(**kwargs)
+ end
+ end
+
def next_page
account_outbox_url(@account, page: true, max_id: @statuses.last.id) if @statuses.size == LIMIT
end
def page_params
{ page: true, max_id: params[:max_id], min_id: params[:min_id] }.compact
end
+
+ def set_account
+ @account = params[:account_username].present? ? Account.find_local!(username_param) : Account.representative
+ end
end
resource :instance_actor, path: 'actor', only: [:show] do
resource :inbox, only: [:create], module: :activitypub
+ resource :outbox, only: [:show], module: :activitypub
end
devise_scope :user do