diff options
author | Evan Minto <evan.minto@gmail.com> | 2017-04-22 20:21:10 -0700 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-23 05:21:10 +0200 |
commit | 66fd8e782182390df81f1ed46f3a04f3a01d681e (patch) | |
tree | f8f6ffb3bfc220e3e8e7efaf273e285b932f1962 /app/views/api | |
parent | 83e35381814baf4ae5f420531d83c0450716f875 (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')
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 |