Progress on dms, code cleanup

Progress on dms, code cleanup
This commit is contained in:
mgabdev
2020-12-02 23:22:51 -05:00
parent 20d4fc09af
commit 9a43c51085
103 changed files with 3656 additions and 859 deletions

View File

@@ -0,0 +1,10 @@
# frozen_string_literal: true
class ChatMessageLengthValidator < ActiveModel::Validator
MAX_CHARS = 1600
def validate(chatMessage)
status.errors.add(:text, I18n.t('statuses.over_character_limit', max: MAX_CHARS)) if chatMessage.text.length > MAX_CHARS
status.errors.add(:text, I18n.t('statuses.over_character_limit', max: MAX_CHARS)) if chatMessage.text.length === 0
end
end

View File

@@ -2,7 +2,7 @@
class PollValidator < ActiveModel::Validator
MAX_OPTIONS = 4
MAX_OPTION_CHARS = 25
MAX_OPTION_CHARS = 160
MAX_EXPIRATION = 1.month.freeze
MIN_EXPIRATION = 5.minutes.freeze