about summary refs log tree commit diff
path: root/app/views/api/activitypub/outbox
diff options
context:
space:
mode:
authorEvan Minto <evan.minto@gmail.com>2017-04-22 20:21:10 -0700
committerEugen <eugen@zeonfederated.com>2017-04-23 05:21:10 +0200
commit66fd8e782182390df81f1ed46f3a04f3a01d681e (patch)
treef8f6ffb3bfc220e3e8e7efaf273e285b932f1962 /app/views/api/activitypub/outbox
parent83e35381814baf4ae5f420531d83c0450716f875 (diff)
ActivityPub: Add basic, read-only support for Outboxes, Notes, and Create/Announce Activities (#2197)
* Clean up collapsible components

* Expose user Outboxes and AS2 representations of statuses

* Save work thus far.

* Fix bad merge.

* Save my work

* Clean up pagination.

* First test working.

* Add tests.

* Add Forbidden error template.

* Revert yarn.lock changes.

* Fix code style deviations and use localized instead of hardcoded English text.
Diffstat (limited to 'app/views/api/activitypub/outbox')
-rw-r--r--app/views/api/activitypub/outbox/show.activitystreams2.rabl23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/views/api/activitypub/outbox/show.activitystreams2.rabl b/app/views/api/activitypub/outbox/show.activitystreams2.rabl
new file mode 100644
index 000000000..a498f74bc
--- /dev/null
+++ b/app/views/api/activitypub/outbox/show.activitystreams2.rabl
@@ -0,0 +1,23 @@
+if @paginated
+  extends 'activitypub/types/ordered_collection_page.activitystreams2.rabl'
+else
+  extends 'activitypub/types/ordered_collection.activitystreams2.rabl'
+end
+
+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(: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