From 3b1390dc789b52cf570a179daf50d4cb8afbfbcd Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 6 Mar 2019 13:36:09 +0100 Subject: Serialize poll limits in instance serializer and initial state --- app/serializers/rest/instance_serializer.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app/serializers/rest') diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index 41ed1995d..9547ba735 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -4,7 +4,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer include RoutingHelper attributes :uri, :title, :description, :email, - :version, :urls, :stats, :thumbnail, :max_toot_chars, + :version, :urls, :stats, :thumbnail, :max_toot_chars, :poll_limits, :languages, :registrations has_one :contact_account, serializer: REST::AccountSerializer @@ -39,6 +39,15 @@ class REST::InstanceSerializer < ActiveModel::Serializer StatusLengthValidator::MAX_CHARS 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 { user_count: instance_presenter.user_count, -- cgit