diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-08-17 21:35:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-17 21:35:00 +0200 |
commit | ad892dbc0c377d82b2cae349f189a41708a1e6af (patch) | |
tree | 6d8754d5a1d2648f4a2d9355dfbe64b5cf5b7942 /app/serializers | |
parent | 075d6a1e13aa6477c656e9dbe03e6720cb4e2b32 (diff) |
Add _:atomUri property for deduplicating OStatus/ActivityPub legacy records (#4593)
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 4c13f8e59..bc8eb8a35 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -8,6 +8,8 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer has_many :media_attachments, key: :attachment has_many :virtual_tags, key: :tag + attribute :atom_uri, key: '_:atomUri', if: :local? + def id ActivityPub::TagManager.instance.uri_for(object) end @@ -52,6 +54,14 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer object.mentions + object.tags end + def atom_uri + ::TagManager.instance.uri_for(object) + end + + def local? + object.account.local? + end + class MediaAttachmentSerializer < ActiveModel::Serializer include RoutingHelper |