about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-06 13:36:09 +0100
committerThibG <thib@sitedethib.com>2019-03-06 23:56:53 +0100
commit3b1390dc789b52cf570a179daf50d4cb8afbfbcd (patch)
treeafb84c3449f4322f4971263b36aad33fc1b7568e /app/serializers/rest
parent8fe86cebaa30e77e50c8223a1ff83759dbd7ca62 (diff)
Serialize poll limits in instance serializer and initial state
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/instance_serializer.rb11
1 files changed, 10 insertions, 1 deletions
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,