From a77e03ede4ba31bd12878f821b63f58e622f06f1 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Tue, 14 Nov 2017 17:56:38 +0100 Subject: [PATCH] Rename MAX_CHARS to MAX_TOOT_CHARS to be more specific. --- .env.production.sample | 2 +- .../mastodon/features/compose/components/compose_form.js | 2 +- app/serializers/initial_state_serializer.rb | 4 ++-- app/serializers/rest/instance_serializer.rb | 4 ++-- app/validators/status_length_validator.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.env.production.sample b/.env.production.sample index 4144044766..27de27de49 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -136,4 +136,4 @@ STREAMING_CLUSTER_NUM=1 # GID=1000 # Maximum allowed character count -# MAX_CHARS=500 +# MAX_TOOT_CHARS=500 diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index b7a7447c48..1d0126dbe3 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -20,7 +20,7 @@ import { length } from 'stringz'; import { countableText } from '../util/counter'; import initialState from '../../../initial_state'; -const maxChars = initialState.max_chars; +const maxChars = initialState.max_toot_chars; const messages = defineMessages({ placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' }, diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index 4550b344e3..b4bdb326bf 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -3,11 +3,11 @@ class InitialStateSerializer < ActiveModel::Serializer attributes :meta, :compose, :accounts, :media_attachments, :settings, :push_subscription, - :max_chars + :max_toot_chars has_many :custom_emojis, serializer: REST::CustomEmojiSerializer - def max_chars + def max_toot_chars StatusLengthValidator::MAX_CHARS end diff --git a/app/serializers/rest/instance_serializer.rb b/app/serializers/rest/instance_serializer.rb index 52c161cb49..abbacc3747 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_chars + :version, :urls, :stats, :thumbnail, :max_toot_chars def uri Rails.configuration.x.local_domain @@ -30,7 +30,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer full_asset_url(instance_presenter.thumbnail.file.url) if instance_presenter.thumbnail end - def max_chars + def max_toot_chars StatusLengthValidator::MAX_CHARS end diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb index 888de5a402..79d17742a9 100644 --- a/app/validators/status_length_validator.rb +++ b/app/validators/status_length_validator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class StatusLengthValidator < ActiveModel::Validator - MAX_CHARS = (ENV['MAX_CHARS'] || 500).to_i + MAX_CHARS = (ENV['MAX_TOOT_CHARS'] || 500).to_i def validate(status) return unless status.local? && !status.reblog?