diff options
author | David Yip <yipdw@member.fsf.org> | 2017-12-04 11:07:01 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-12-04 11:07:01 -0600 |
commit | d9800a5647cbc57db7679094b2271f8eb5ec328b (patch) | |
tree | f9210c465de5f9d80e294d9ffa8536f98f9c466e /app/serializers | |
parent | 1c74ede69e7a9916c19da6f05daa215231eba81c (diff) | |
parent | f2f2f1032082d6212771bd0307136484f671d37e (diff) |
Merge branch 'gs-master' into glitch-theme
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/actor_serializer.rb | 8 | ||||
-rw-r--r-- | app/serializers/rest/account_serializer.rb | 4 | ||||
-rw-r--r-- | app/serializers/rest/list_serializer.rb | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index 896d67115..622bdde0c 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -10,6 +10,8 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer has_one :public_key, serializer: ActivityPub::PublicKeySerializer + attribute :moved_to, if: :moved? + class EndpointsSerializer < ActiveModel::Serializer include RoutingHelper @@ -25,6 +27,8 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer has_one :icon, serializer: ActivityPub::ImageSerializer, if: :avatar_exists? has_one :image, serializer: ActivityPub::ImageSerializer, if: :header_exists? + delegate :moved?, to: :object + def id account_url(object) end @@ -92,4 +96,8 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer def manually_approves_followers object.locked end + + def moved_to + ActivityPub::TagManager.instance.uri_for(object.moved_to_account) + end end diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 65fdb0308..bab944c5a 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -7,6 +7,10 @@ class REST::AccountSerializer < ActiveModel::Serializer :note, :url, :avatar, :avatar_static, :header, :header_static, :followers_count, :following_count, :statuses_count + has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved? + + delegate :moved?, to: :object + def id object.id.to_s end diff --git a/app/serializers/rest/list_serializer.rb b/app/serializers/rest/list_serializer.rb index c0150888e..977da7439 100644 --- a/app/serializers/rest/list_serializer.rb +++ b/app/serializers/rest/list_serializer.rb @@ -2,4 +2,8 @@ class REST::ListSerializer < ActiveModel::Serializer attributes :id, :title + + def id + object.id.to_s + end end |