Publish noai, noindex or other_settings on activitypub

This commit is contained in:
KMY 2023-05-14 13:22:44 +09:00
parent a4de9fcfdb
commit 062da7f31d
5 changed files with 34 additions and 11 deletions

View file

@ -7,13 +7,14 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
context :security
context_extensions :manually_approves_followers, :featured, :also_known_as,
:moved_to, :property_value, :discoverable, :olm, :suspended, :searchable_by, :subscribable_by
:moved_to, :property_value, :discoverable, :olm, :suspended, :searchable_by, :subscribable_by,
:other_setting
attributes :id, :type, :following, :followers,
:inbox, :outbox, :featured, :featured_tags,
:preferred_username, :name, :summary,
:url, :manually_approves_followers,
:discoverable, :published, :searchable_by, :subscribable_by, :obher_setting
:discoverable, :published, :searchable_by, :subscribable_by, :other_setting
has_one :public_key, serializer: ActivityPub::PublicKeySerializer
@ -170,6 +171,21 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer
ActivityPub::TagManager.instance.subscribable_by(object)
end
def other_setting
hash = []
if object.settings.present?
hash = object.settings.map do |k, v|
{
type: 'PropertyValue',
name: k,
value: v,
}
end
end
hash << { type: 'PropertyValue', name: 'noindex', value: object.noindex? }
hash << { type: 'PropertyValue', name: 'noai', value: object.noai? }
end
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
end