From 6cd192b9fb3dcb40a87cfb8b1bd0c5416b686a41 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Tue, 14 Nov 2017 16:22:34 +0100 Subject: [PATCH] Make character limit configurable. --- .env.production.sample | 3 +++ app/validators/status_length_validator.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env.production.sample b/.env.production.sample index 91fcce6ac4..4144044766 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -134,3 +134,6 @@ STREAMING_CLUSTER_NUM=1 # If you use Docker, you may want to assign UID/GID manually. # UID=1000 # GID=1000 + +# Maximum allowed character count +# MAX_CHARS=500 diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb index 77be3f1f54..2be899740f 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 = 500 + MAX_CHARS = (ENV["MAX_CHARS"] || 500).to_i def validate(status) return unless status.local? && !status.reblog?