diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb index 201ce75f5c..b16c79ac79 100644 --- a/app/models/featured_tag.rb +++ b/app/models/featured_tag.rb @@ -26,6 +26,8 @@ class FeaturedTag < ApplicationRecord attr_writer :name + LIMIT = 10 + def name tag_id.present? ? tag.name : @name end @@ -50,7 +52,7 @@ class FeaturedTag < ApplicationRecord end def validate_featured_tags_limit - errors.add(:base, I18n.t('featured_tags.errors.limit')) if account.featured_tags.count >= 10 + errors.add(:base, I18n.t('featured_tags.errors.limit')) if account.featured_tags.count >= LIMIT end def validate_tag_name diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index dfa8ce40a8..7d00b20ba0 100644 --- a/app/serializers/rest/instance_serializer.rb +++ b/app/serializers/rest/instance_serializer.rb @@ -47,6 +47,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer streaming: Rails.configuration.x.streaming_api_base_url, }, + accounts: { + max_featured_tags: FeaturedTag::LIMIT, + }, + statuses: { max_characters: StatusLengthValidator::MAX_CHARS, max_media_attachments: 4,