Add support for direct message assertions
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user