Support customizing poll option limits
This commit is contained in:
parent
d85f034676
commit
3a774aa017
2 changed files with 8 additions and 2 deletions
|
@ -254,6 +254,12 @@ MAX_PROFILE_FIELDS=4
|
||||||
# Maximum allowed display name characters
|
# Maximum allowed display name characters
|
||||||
MAX_DISPLAY_NAME_CHARS=30
|
MAX_DISPLAY_NAME_CHARS=30
|
||||||
|
|
||||||
|
# Maximum allowed poll options
|
||||||
|
MAX_POLL_OPTIONS=5
|
||||||
|
|
||||||
|
# Maximum allowed poll option characters
|
||||||
|
MAX_POLL_OPTION_CHARS=100
|
||||||
|
|
||||||
# Maximum image and video/audio upload sizes
|
# Maximum image and video/audio upload sizes
|
||||||
# Units are in bytes
|
# Units are in bytes
|
||||||
# 1048576 bytes equals 1 megabyte
|
# 1048576 bytes equals 1 megabyte
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PollValidator < ActiveModel::Validator
|
class PollValidator < ActiveModel::Validator
|
||||||
MAX_OPTIONS = 5
|
MAX_OPTIONS = (ENV['MAX_POLL_OPTIONS'] || 5).to_i
|
||||||
MAX_OPTION_CHARS = 100
|
MAX_OPTION_CHARS = (ENV['MAX_POLL_OPTION_CHARS'] || 100).to_i
|
||||||
MAX_EXPIRATION = 1.month.freeze
|
MAX_EXPIRATION = 1.month.freeze
|
||||||
MIN_EXPIRATION = 5.minutes.freeze
|
MIN_EXPIRATION = 5.minutes.freeze
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue