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

@@ -2,7 +2,8 @@ require 'digest/sha1'
class Dmail < ApplicationRecord
validate :validate_sender_is_not_limited, on: :create
validates_presence_of :title, :body, on: :create
validates :title, presence: true, length: { maximum: 200 }, if: :title_changed?
validates :body, presence: true, length: { maximum: 50_000 }, if: :body_changed?
belongs_to :owner, :class_name => "User"
belongs_to :to, :class_name => "User"