Add MAX_POLL_OPTIONS

This commit is contained in:
bgme 2026-01-31 00:13:25 +08:00
parent de081c7930
commit 139ca60bb2
2 changed files with 7 additions and 2 deletions

View file

@ -91,4 +91,9 @@ SESSION_RETENTION_PERIOD=31556952
# Max status length limit
# Maximum allowed character count of one status
# MAX_STATUS_CHARS=500
# MAX_STATUS_CHARS=500
# Max poll option limit
# Maximum allowed poll option number
# MAX_POLL_OPTIONS=16

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
class PollOptionsValidator < ActiveModel::Validator
MAX_OPTIONS = 4
MAX_OPTIONS = (ENV['MAX_POLL_OPTIONS'] || 4).to_i
MAX_OPTION_CHARS = 50
def validate(poll)