diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-03 04:52:21 -0500 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2020-08-04 19:43:19 +0200 |
commit | 3d5b3e357c26aeee86da8f69a86130d52f325729 (patch) | |
tree | 1d7de09a4fd381f6dad447c3753cd61cf718ff4b /app/serializers | |
parent | b988bc75649425266e848a25290a86a9fc53625e (diff) |
Add support for direct message assertions
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/activitypub/note_serializer.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index a06cd17d4..a0965790e 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ActivityPub::NoteSerializer < ActivityPub::Serializer - context_extensions :atom_uri, :conversation, :sensitive, :voters_count + context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :direct_message attributes :id, :type, :summary, :in_reply_to, :published, :url, @@ -12,6 +12,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer attribute :content attribute :content_map, if: :language? + attribute :direct_message, if: :non_public? + has_many :media_attachments, key: :attachment has_many :virtual_tags, key: :tag @@ -42,6 +44,14 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer object.sensitive || (!instance_options[:allow_local_only] && Setting.outgoing_spoilers.present?) end + def direct_message + object.direct_visibility? + end + + def non_public? + !object.distributable? + end + def content Formatter.instance.format(object) end |