From 2a2698e4501094ca52b8b166c2c51fab26ce7427 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 26 Aug 2017 15:32:40 +0200 Subject: Add ActivityPub serializer for Undo of Announce (#4703) --- .../activitypub/undo_announce_serializer.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/serializers/activitypub/undo_announce_serializer.rb (limited to 'app/serializers') diff --git a/app/serializers/activitypub/undo_announce_serializer.rb b/app/serializers/activitypub/undo_announce_serializer.rb new file mode 100644 index 000000000..839847e22 --- /dev/null +++ b/app/serializers/activitypub/undo_announce_serializer.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ActivityPub::UndoAnnounceSerializer < ActiveModel::Serializer + attributes :id, :type, :actor + + has_one :object, serializer: ActivityPub::ActivitySerializer + + def id + [ActivityPub::TagManager.instance.uri_for(object.account), '#announces/', object.id, '/undo'].join + end + + def type + 'Undo' + end + + def actor + ActivityPub::TagManager.instance.uri_for(object.account) + end +end -- cgit