Add default quote policy to API (#35948)

This commit is contained in:
Claire 2025-08-29 13:37:20 +02:00 committed by GitHub
parent 4ecbaea8bb
commit 8b7685d956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View File

@ -48,6 +48,7 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
default_privacy: source_params.fetch(:privacy, @account.user.setting_default_privacy), default_privacy: source_params.fetch(:privacy, @account.user.setting_default_privacy),
default_sensitive: source_params.fetch(:sensitive, @account.user.setting_default_sensitive), default_sensitive: source_params.fetch(:sensitive, @account.user.setting_default_sensitive),
default_language: source_params.fetch(:language, @account.user.setting_default_language), default_language: source_params.fetch(:language, @account.user.setting_default_language),
default_quote_policy: source_params.fetch(:quote_policy, @account.user.setting_default_quote_policy),
}, },
} }
end end

View File

@ -19,6 +19,7 @@ class REST::CredentialAccountSerializer < REST::AccountSerializer
discoverable: object.discoverable, discoverable: object.discoverable,
indexable: object.indexable, indexable: object.indexable,
attribution_domains: object.attribution_domains, attribution_domains: object.attribution_domains,
quote_policy: user.setting_default_quote_policy,
} }
end end

View File

@ -4,6 +4,7 @@ class REST::PreferencesSerializer < ActiveModel::Serializer
attribute :posting_default_privacy, key: 'posting:default:visibility' attribute :posting_default_privacy, key: 'posting:default:visibility'
attribute :posting_default_sensitive, key: 'posting:default:sensitive' attribute :posting_default_sensitive, key: 'posting:default:sensitive'
attribute :posting_default_language, key: 'posting:default:language' attribute :posting_default_language, key: 'posting:default:language'
attribute :posting_default_quote_policy, key: 'posting:default:quote_policy'
attribute :reading_default_sensitive_media, key: 'reading:expand:media' attribute :reading_default_sensitive_media, key: 'reading:expand:media'
attribute :reading_default_sensitive_text, key: 'reading:expand:spoilers' attribute :reading_default_sensitive_text, key: 'reading:expand:spoilers'
@ -13,6 +14,10 @@ class REST::PreferencesSerializer < ActiveModel::Serializer
object.user.setting_default_privacy object.user.setting_default_privacy
end end
def posting_default_quote_policy
object.user.setting_default_quote_policy
end
def posting_default_sensitive def posting_default_sensitive
object.user.setting_default_sensitive object.user.setting_default_sensitive
end end