Serialize poll limits in instance serializer and initial state
parent
e2d56cc90d
commit
9f06da948b
|
@ -3,7 +3,7 @@
|
||||||
class InitialStateSerializer < ActiveModel::Serializer
|
class InitialStateSerializer < ActiveModel::Serializer
|
||||||
attributes :meta, :compose, :accounts,
|
attributes :meta, :compose, :accounts,
|
||||||
:media_attachments, :settings,
|
:media_attachments, :settings,
|
||||||
:max_toot_chars
|
:max_toot_chars, :poll_limits
|
||||||
|
|
||||||
has_one :push_subscription, serializer: REST::WebPushSubscriptionSerializer
|
has_one :push_subscription, serializer: REST::WebPushSubscriptionSerializer
|
||||||
|
|
||||||
|
@ -11,6 +11,15 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||||
StatusLengthValidator::MAX_CHARS
|
StatusLengthValidator::MAX_CHARS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def poll_limits
|
||||||
|
{
|
||||||
|
max_options: PollValidator::MAX_OPTIONS,
|
||||||
|
max_option_chars: PollValidator::MAX_OPTION_CHARS,
|
||||||
|
min_expiration: PollValidator::MAX_EXPIRATION,
|
||||||
|
max_expiration: PollValidator::MIN_EXPIRATION,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def meta
|
def meta
|
||||||
store = {
|
store = {
|
||||||
streaming_api_base_url: Rails.configuration.x.streaming_api_base_url,
|
streaming_api_base_url: Rails.configuration.x.streaming_api_base_url,
|
||||||
|
|
|
@ -4,7 +4,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
|
|
||||||
attributes :uri, :title, :description, :email,
|
attributes :uri, :title, :description, :email,
|
||||||
:version, :urls, :stats, :thumbnail, :max_toot_chars,
|
:version, :urls, :stats, :thumbnail, :max_toot_chars, :poll_limits,
|
||||||
:languages, :registrations
|
:languages, :registrations
|
||||||
|
|
||||||
has_one :contact_account, serializer: REST::AccountSerializer
|
has_one :contact_account, serializer: REST::AccountSerializer
|
||||||
|
@ -39,6 +39,15 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||||
StatusLengthValidator::MAX_CHARS
|
StatusLengthValidator::MAX_CHARS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def poll_limits
|
||||||
|
{
|
||||||
|
max_options: PollValidator::MAX_OPTIONS,
|
||||||
|
max_option_chars: PollValidator::MAX_OPTION_CHARS,
|
||||||
|
min_expiration: PollValidator::MAX_EXPIRATION,
|
||||||
|
max_expiration: PollValidator::MIN_EXPIRATION,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def stats
|
def stats
|
||||||
{
|
{
|
||||||
user_count: instance_presenter.user_count,
|
user_count: instance_presenter.user_count,
|
||||||
|
|
Loading…
Reference in New Issue