From e3095abda62136440c3deb843a8a203487c5606d Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 12 Jan 2023 12:51:21 +0000 Subject: [PATCH] Add max_toot_chars to API v1 --- patches/max-toot-chars-api.patch | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/patches/max-toot-chars-api.patch b/patches/max-toot-chars-api.patch index 62f054c..7644ac7 100644 --- a/patches/max-toot-chars-api.patch +++ b/patches/max-toot-chars-api.patch @@ -19,3 +19,25 @@ index 5ae1099d0..c9c76c700 100644 def thumbnail if object.thumbnail { +diff --git a/app/serializers/rest/v1/instance_serializer.rb b/app/serializers/rest/v1/instance_serializer.rb +index 99d1b2bd6..b5e6c8185 100644 +--- a/app/serializers/rest/v1/instance_serializer.rb ++++ b/app/serializers/rest/v1/instance_serializer.rb +@@ -6,12 +6,17 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer + attributes :uri, :title, :short_description, :description, :email, + :version, :urls, :stats, :thumbnail, + :languages, :registrations, :approval_required, :invites_enabled, ++ :max_toot_chars, + :configuration + + has_one :contact_account, serializer: REST::AccountSerializer + + has_many :rules, serializer: REST::RuleSerializer + ++ def max_toot_chars ++ StatusLengthValidator::MAX_CHARS ++ end ++ + def uri + object.domain + end