Add limited_scope support
This commit is contained in:
parent
ec16074def
commit
c1f6d22ad2
17 changed files with 107 additions and 10 deletions
|
@ -3,13 +3,13 @@
|
|||
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
include FormattingHelper
|
||||
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :searchable_by, :references
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :searchable_by, :references, :limited_scope
|
||||
|
||||
attributes :id, :type, :summary,
|
||||
:in_reply_to, :published, :url,
|
||||
:attributed_to, :to, :cc, :sensitive,
|
||||
:atom_uri, :in_reply_to_atom_uri,
|
||||
:conversation, :searchable_by
|
||||
:conversation, :searchable_by, :limited_scope
|
||||
|
||||
attribute :references, if: :not_private_post?
|
||||
|
||||
|
@ -148,6 +148,10 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
ActivityPub::TagManager.instance.searchable_by(object)
|
||||
end
|
||||
|
||||
def limited_scope
|
||||
ActivityPub::TagManager.instance.limited_scope(object)
|
||||
end
|
||||
|
||||
def local?
|
||||
object.account.local?
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||
include FormattingHelper
|
||||
|
||||
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
|
||||
:sensitive, :spoiler_text, :visibility, :visibility_ex, :language,
|
||||
:sensitive, :spoiler_text, :visibility, :visibility_ex, :limited_scope, :language,
|
||||
:uri, :url, :replies_count, :reblogs_count, :searchability, :markdown,
|
||||
:status_reference_ids, :status_references_count, :status_referred_by_count,
|
||||
:favourites_count, :emoji_reactions, :emoji_reactions_count, :reactions, :edited_at
|
||||
|
@ -69,6 +69,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||
object.visibility
|
||||
end
|
||||
|
||||
def limited_scope
|
||||
!object.none_limited? && object.limited_visibility? ? object.limited_scope : nil
|
||||
end
|
||||
|
||||
def searchability
|
||||
object.compute_searchability
|
||||
end
|
||||
|
|
|
@ -128,6 +128,7 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
|||
:kmyblue_visibility_login,
|
||||
:status_reference,
|
||||
:visibility_mutual,
|
||||
:kmyblue_limited_scope,
|
||||
]
|
||||
|
||||
capabilities << :profile_search unless Chewy.enabled?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue