]> cat aescling's git repositories - mastodon.git/commitdiff
Make character limit configurable.
authorLain Iwakura <lain@soykaf.club>
Tue, 14 Nov 2017 15:22:34 +0000 (16:22 +0100)
committerLain Iwakura <lain@soykaf.club>
Tue, 14 Nov 2017 15:22:34 +0000 (16:22 +0100)
.env.production.sample
app/validators/status_length_validator.rb

index 91fcce6ac4568bf1193ea56db6af9e54cc85d8b9..41440447669bf1901a1c15e41b8a244378598710 100644 (file)
@@ -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
index 77be3f1f5437e79a253dc29726d4cd81ded5f19d..2be899740f1d5cadd1139ac6188994a4f54d485a 100644 (file)
@@ -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?