From 122d59ac41a0c637b19357c2b7422002ffa0381c Mon Sep 17 00:00:00 2001 From: Evan Minto Date: Tue, 25 Apr 2017 06:06:06 -0700 Subject: Change ActivityPub paging to match spec. Clean up ActivityPub outbox changes. (#2410) * Change ActivityPub paging to match spec. Clean up ActivityPub outbox changes. * Fix code style and test failures for OutboxController. * Attempt to fix CI errors. --- .../activitypub/outbox/show.activitystreams2.rabl | 21 +++++---------------- .../outbox/show_page.activitystreams2.rabl | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 app/views/api/activitypub/outbox/show_page.activitystreams2.rabl (limited to 'app/views/api') diff --git a/app/views/api/activitypub/outbox/show.activitystreams2.rabl b/app/views/api/activitypub/outbox/show.activitystreams2.rabl index a498f74bc..273b15e82 100644 --- a/app/views/api/activitypub/outbox/show.activitystreams2.rabl +++ b/app/views/api/activitypub/outbox/show.activitystreams2.rabl @@ -1,23 +1,12 @@ -if @paginated - extends 'activitypub/types/ordered_collection_page.activitystreams2.rabl' -else - extends 'activitypub/types/ordered_collection.activitystreams2.rabl' -end +extends 'activitypub/types/ordered_collection.activitystreams2.rabl' object @account -node(:items) do - @statuses.map { |status| api_activitypub_status_url(status) } -end - node(:totalItems) { @statuses.count } -node(:next) { @next_path } if @next_path -node(:prev) { @prev_path } if @prev_path +node(:current) { @first_page_url } if @first_page_url +node(:first) { @first_page_url } if @first_page_url +node(:last) { @last_page_url } if @last_page_url node(:name) { |account| t('activitypub.outbox.name', account_name: account_name(account)) } node(:summary) { |account| t('activitypub.outbox.summary', account_name: account_name(account)) } -node(:updated) do |account| - times = @statuses.map { |status| status.updated_at.to_time } - times << account.created_at.to_time - times.max.xmlschema -end +node(:updated) { |account| (@statuses.empty? ? account.created_at.to_time : @statuses.first.updated_at.to_time).xmlschema } diff --git a/app/views/api/activitypub/outbox/show_page.activitystreams2.rabl b/app/views/api/activitypub/outbox/show_page.activitystreams2.rabl new file mode 100644 index 000000000..b6433ccf2 --- /dev/null +++ b/app/views/api/activitypub/outbox/show_page.activitystreams2.rabl @@ -0,0 +1,16 @@ +extends 'activitypub/types/ordered_collection_page.activitystreams2.rabl' + +object @account + +node(:items) do + @statuses.map { |status| api_activitypub_status_url(status) } +end + +node(:next) { @next_page_url } if @next_page_url +node(:prev) { @prev_page_url } if @prev_page_url +node(:current) { @first_page_url } if @first_page_url +node(:first) { @first_page_url } if @first_page_url +node(:last) { @last_page_url } if @last_page_url +node(:partOf) { @part_of_url } if @part_of_url + +node(:updated) { |account| (@statuses.empty? ? account.created_at.to_time : @statuses.first.updated_at.to_time).xmlschema } -- cgit