From de081c793088114b695890ac47e612c74b5f40a8 Mon Sep 17 00:00:00 2001 From: bgme Date: Fri, 30 Jan 2026 23:56:31 +0800 Subject: [PATCH] Add MAX_STATUS_CHARS --- .env.production.sample | 4 ++++ app/validators/status_length_validator.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.production.sample b/.env.production.sample index 9ff63c49e..04a5d71a6 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -88,3 +88,7 @@ S3_ALIAS_HOST=files.example.com # ----------------------- IP_RETENTION_PERIOD=31556952 SESSION_RETENTION_PERIOD=31556952 + +# Max status length limit +# Maximum allowed character count of one status +# MAX_STATUS_CHARS=500 \ No newline at end of file diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb index 575aaf186..fdfa4b51f 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_STATUS_CHARS'] || 500).to_i URL_PLACEHOLDER_CHARS = 23 URL_PLACEHOLDER = 'x' * 23