lor.sh/patches/max-toot-chars-api.patch

46 lines
1.6 KiB
Diff

diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb
index 19361277a..03dc1ad85 100644
--- a/app/serializers/rest/instance_serializer.rb
+++ b/app/serializers/rest/instance_serializer.rb
@@ -11,12 +11,17 @@ class REST::InstanceSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :domain, :title, :version, :source_url, :description,
+ :max_toot_chars,
:usage, :thumbnail, :icon, :languages, :configuration,
:registrations, :api_versions
has_one :contact, serializer: ContactSerializer
has_many :rules, serializer: REST::RuleSerializer
+ def max_toot_chars
+ StatusLengthValidator::MAX_CHARS
+ end
+
def thumbnail
if object.thumbnail
{
diff --git a/app/serializers/rest/v1/instance_serializer.rb b/app/serializers/rest/v1/instance_serializer.rb
index 7f9f21c5a..c99f1f9c1 100644
--- a/app/serializers/rest/v1/instance_serializer.rb
+++ b/app/serializers/rest/v1/instance_serializer.rb
@@ -4,6 +4,7 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :uri, :title, :short_description, :description, :email,
+ :max_toot_chars,
:version, :urls, :stats, :thumbnail,
:languages, :registrations, :approval_required, :invites_enabled,
:configuration
@@ -12,6 +13,10 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
has_many :rules, serializer: REST::RuleSerializer
+ def max_toot_chars
+ StatusLengthValidator::MAX_CHARS
+ end
+
def uri
object.domain
end