Rename MAX_CHARS to MAX_TOOT_CHARS to be more specific.

This commit is contained in:
Lain Iwakura 2017-11-14 17:56:38 +01:00
parent dae8916544
commit ca5440b93d
5 changed files with 7 additions and 7 deletions

View File

@ -136,4 +136,4 @@ STREAMING_CLUSTER_NUM=1
# GID=1000
# Maximum allowed character count
# MAX_CHARS=500
# MAX_TOOT_CHARS=500

View File

@ -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?' },

View File

@ -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

View File

@ -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

View File

@ -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?