about summary refs log tree commit diff
path: root/app/serializers/activitypub
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-11-18 19:39:02 +0100
committerGitHub <noreply@github.com>2017-11-18 19:39:02 +0100
commit58cede4808baa4db6cc143b80ef23e8179a8415b (patch)
treeacaac099fc46d9293768f9fa70c1d1826d06d7e8 /app/serializers/activitypub
parent6be72a3ec6d87af4de245b96fea45191ac01114e (diff)
Profile redirect notes (#5746)
* Serialize moved accounts into REST and ActivityPub APIs

* Parse federated moved accounts from ActivityPub

* Add note about moved accounts to public profiles

* Add moved account message to web UI

* Fix code style issues
Diffstat (limited to 'app/serializers/activitypub')
-rw-r--r--app/serializers/activitypub/actor_serializer.rb8
1 files changed, 8 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