Add max lengths to comments, dmails, and forum posts.

* Max comment length: 15,000 characters.
* Max forum post length: 200,000 characters.
* Max forum topic title length: 200 characters.
* Max dmail length: 50,000 characters.
* Max dmail title length: 200 characters.
This commit is contained in:
evazion
2021-03-08 18:46:49 -06:00
parent 0249c290fd
commit 5623cfb145
4 changed files with 9 additions and 5 deletions

View File

@@ -21,11 +21,11 @@ class ForumTopic < ApplicationRecord
has_many :tag_aliases, :foreign_key => "forum_topic_id"
has_many :tag_implications, :foreign_key => "forum_topic_id"
validates_presence_of :title
validates :title, presence: true, length: { maximum: 200 }, if: :title_changed?
validates_associated :original_post
validates_inclusion_of :category_id, :in => CATEGORIES.keys
validates_inclusion_of :min_level, :in => MIN_LEVELS.values
validates :title, :length => {:maximum => 255}
accepts_nested_attributes_for :original_post
after_update :update_orignal_post
after_save(:if => ->(rec) {rec.is_locked? && rec.saved_change_to_is_locked?}) do |rec|