Use previously extracted model constants in form maxlength
attributes (#32113)
This commit is contained in:
parent
04dd3a9eb6
commit
e02e88bff4
5 changed files with 10 additions and 8 deletions
|
@ -73,6 +73,8 @@ class Form::AdminSettings
|
|||
authorized_fetch: :authorized_fetch_mode?,
|
||||
}.freeze
|
||||
|
||||
DESCRIPTION_LIMIT = 200
|
||||
|
||||
attr_accessor(*KEYS)
|
||||
|
||||
validates :registrations_mode, inclusion: { in: %w(open approved none) }, if: -> { defined?(@registrations_mode) }
|
||||
|
@ -82,7 +84,7 @@ class Form::AdminSettings
|
|||
validates :show_domain_blocks, inclusion: { in: %w(disabled users all) }, if: -> { defined?(@show_domain_blocks) }
|
||||
validates :show_domain_blocks_rationale, inclusion: { in: %w(disabled users all) }, if: -> { defined?(@show_domain_blocks_rationale) }
|
||||
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
|
||||
validates :site_short_description, length: { maximum: 200 }, if: -> { defined?(@site_short_description) }
|
||||
validates :site_short_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@site_short_description) }
|
||||
validates :status_page_url, url: true, allow_blank: true
|
||||
validate :validate_site_uploads
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue