logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: a6328fc1b17984af71efb9a1214437c8cdc5dfea
parent: 35b868eeca3f9000d9de0ec232ad93f430563448
Author: Eugen Rochko <eugen@zeonfederated.com>
Date:   Sun, 16 Jul 2017 10:28:55 +0200

Minor ActivityPub JSON fixes (#4214)

- Objects must have attributedTo instead of actor
- The current attribute belongs to CollectionPage, not Collection

Diffstat:

Mapp/controllers/activitypub/outboxes_controller.rb1-
Mapp/controllers/follower_accounts_controller.rb1-
Mapp/controllers/following_accounts_controller.rb1-
Mapp/controllers/tags_controller.rb1-
Mapp/presenters/activitypub/collection_presenter.rb2+-
Mapp/serializers/activitypub/collection_serializer.rb3+--
Mapp/serializers/activitypub/note_serializer.rb4++--
7 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/app/controllers/activitypub/outboxes_controller.rb b/app/controllers/activitypub/outboxes_controller.rb @@ -20,7 +20,6 @@ class ActivityPub::OutboxesController < Api::BaseController ActivityPub::CollectionPresenter.new( id: account_outbox_url(@account), type: :ordered, - current: account_outbox_url(@account), size: @account.statuses_count, items: @statuses ) diff --git a/app/controllers/follower_accounts_controller.rb b/app/controllers/follower_accounts_controller.rb @@ -21,7 +21,6 @@ class FollowerAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_followers_url(@account), type: :ordered, - current: account_followers_url(@account), size: @account.followers_count, items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) } ) diff --git a/app/controllers/following_accounts_controller.rb b/app/controllers/following_accounts_controller.rb @@ -21,7 +21,6 @@ class FollowingAccountsController < ApplicationController ActivityPub::CollectionPresenter.new( id: account_following_index_url(@account), type: :ordered, - current: account_following_index_url(@account), size: @account.following_count, items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) } ) diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb @@ -23,7 +23,6 @@ class TagsController < ApplicationController ActivityPub::CollectionPresenter.new( id: tag_url(@tag), type: :ordered, - current: tag_url(@tag), size: @tag.statuses.count, items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) } ) diff --git a/app/presenters/activitypub/collection_presenter.rb b/app/presenters/activitypub/collection_presenter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class ActivityPub::CollectionPresenter < ActiveModelSerializers::Model - attributes :id, :type, :current, :size, :items + attributes :id, :type, :size, :items end diff --git a/app/serializers/activitypub/collection_serializer.rb b/app/serializers/activitypub/collection_serializer.rb @@ -6,8 +6,7 @@ class ActivityPub::CollectionSerializer < ActiveModel::Serializer super end - attributes :id, :type, :total_items, - :current + attributes :id, :type, :total_items has_many :items, key: :ordered_items diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb @@ -3,7 +3,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer attributes :id, :type, :summary, :content, :in_reply_to, :published, :url, - :actor, :to, :cc, :sensitive + :attributed_to, :to, :cc, :sensitive has_many :media_attachments, key: :attachment has_many :virtual_tags, key: :tag @@ -36,7 +36,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer ActivityPub::TagManager.instance.url_for(object) end - def actor + def attributed_to ActivityPub::TagManager.instance.uri_for(object.account) end