about summary refs log tree commit diff
path: root/app/serializers/activitypub/move_serializer.rb
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-09-30 16:38:09 -0700
committerReverite <github@reverite.sh>2019-09-30 16:38:09 -0700
commit01001ba118d7adcd4966c893cf95db32fe76c273 (patch)
treefc8b580c8f0a3c1e14a8ca20e3bea5bd7acb4ff1 /app/serializers/activitypub/move_serializer.rb
parent1e75b3d874973dd71ea74b158ebeb501d9ac68a3 (diff)
parent65db9df011a3e13efa79f4e56343aa69bdad7716 (diff)
Merge branch 'glitch' into production
Diffstat (limited to 'app/serializers/activitypub/move_serializer.rb')
-rw-r--r--app/serializers/activitypub/move_serializer.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/serializers/activitypub/move_serializer.rb b/app/serializers/activitypub/move_serializer.rb
new file mode 100644
index 000000000..5675875fa
--- /dev/null
+++ b/app/serializers/activitypub/move_serializer.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ActivityPub::MoveSerializer < ActivityPub::Serializer
+  attributes :id, :type, :target, :actor
+  attribute :virtual_object, key: :object
+
+  def id
+    [ActivityPub::TagManager.instance.uri_for(object.account), '#moves/', object.id].join
+  end
+
+  def type
+    'Move'
+  end
+
+  def target
+    ActivityPub::TagManager.instance.uri_for(object.target_account)
+  end
+
+  def virtual_object
+    ActivityPub::TagManager.instance.uri_for(object.account)
+  end
+
+  def actor
+    ActivityPub::TagManager.instance.uri_for(object.account)
+  end
+end