Merge pull request #4573 from artoscinote/ma_SCI_7377

Add ENV setting for max step text length [SCI-7377]
This commit is contained in:
artoscinote 2022-10-25 16:04:36 +02:00 committed by GitHub
commit 938f2ce63b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,11 @@ class StepText < ApplicationRecord
include ActionView::Helpers::TextHelper
auto_strip_attributes :text, nullify: false
validates :text, length: { maximum: Constants::RICH_TEXT_MAX_LENGTH }
validates :text, length:
{
maximum:
ENV['STEP_TEXT_MAX_LENGTH'].present? ? ENV['STEP_TEXT_MAX_LENGTH'].to_i : Constants::RICH_TEXT_MAX_LENGTH
}
belongs_to :step, inverse_of: :step_texts, touch: true
has_one :step_orderable_element, as: :orderable, dependent: :destroy