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

@@ -6,7 +6,7 @@ class Comment < ApplicationRecord
has_many :moderation_reports, as: :model
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
validates :body, presence: true
validates :body, presence: true, length: { maximum: 15_000 }, if: :body_changed?
before_create :autoreport_spam
after_create :update_last_commented_at_on_create