about summary refs log tree commit diff
path: root/app/views/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/api')
-rw-r--r--app/views/api/activitypub/activities/_show_status.activitystreams2.rabl4
-rw-r--r--app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl8
-rw-r--r--app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl8
-rw-r--r--app/views/api/activitypub/notes/show.activitystreams2.rabl11
-rw-r--r--app/views/api/activitypub/outbox/show.activitystreams2.rabl23
5 files changed, 54 insertions, 0 deletions
diff --git a/app/views/api/activitypub/activities/_show_status.activitystreams2.rabl b/app/views/api/activitypub/activities/_show_status.activitystreams2.rabl
new file mode 100644
index 000000000..472bf5dbd
--- /dev/null
+++ b/app/views/api/activitypub/activities/_show_status.activitystreams2.rabl
@@ -0,0 +1,4 @@
+object @status
+
+node(:actor)     { |status| TagManager.instance.url_for(status.account) }
+node(:published) { |status| status.created_at.to_time.xmlschema }
\ No newline at end of file
diff --git a/app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl b/app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl
new file mode 100644
index 000000000..44ac1ba2f
--- /dev/null
+++ b/app/views/api/activitypub/activities/show_status_announce.activitystreams2.rabl
@@ -0,0 +1,8 @@
+extends 'activitypub/types/announce.activitystreams2.rabl'
+extends 'api/activitypub/activities/_show_status.activitystreams2.rabl'
+
+object @status
+
+node(:name)   { |status| t('activitypub.activity.announce.name', account_name: account_name(status.account)) }
+node(:url)    { |status| TagManager.instance.url_for(status) }
+node(:object) { |status| api_activitypub_status_url(status.reblog_of_id) }
diff --git a/app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl b/app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl
new file mode 100644
index 000000000..ff4d39eca
--- /dev/null
+++ b/app/views/api/activitypub/activities/show_status_create.activitystreams2.rabl
@@ -0,0 +1,8 @@
+extends 'activitypub/types/create.activitystreams2.rabl'
+extends 'api/activitypub/activities/_show_status.activitystreams2.rabl'
+
+object @status
+
+node(:name)   { |status| t('activitypub.activity.create.name', account_name: account_name(status.account)) }
+node(:url)    { |status| TagManager.instance.url_for(status) }
+node(:object) { |status| api_activitypub_note_url(status) }
diff --git a/app/views/api/activitypub/notes/show.activitystreams2.rabl b/app/views/api/activitypub/notes/show.activitystreams2.rabl
new file mode 100644
index 000000000..d962f4438
--- /dev/null
+++ b/app/views/api/activitypub/notes/show.activitystreams2.rabl
@@ -0,0 +1,11 @@
+extends 'activitypub/types/note.activitystreams2.rabl'
+
+object @status
+
+attributes :content
+
+node(:name)         { |status| status.content }
+node(:url)          { |status| TagManager.instance.url_for(status) }
+node(:attributedTo) { |status| TagManager.instance.url_for(status.account) }
+node(:inReplyTo)    { |status| api_activitypub_note_url(status.thread) } if @status.thread
+node(:published)    { |status| status.created_at.to_time.xmlschema }
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