posts: limit sources to 1200 chars long.

The longest sources on Danbooru are DeviantArt wixmp.com sources, which
max out at ~900 chars.
This commit is contained in:
evazion
2020-12-21 18:57:04 -06:00
parent 6ac9882711
commit 6c99bbbf47
2 changed files with 8 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ class Post < ApplicationRecord
before_validation :remove_parent_loops
validates_uniqueness_of :md5, :on => :create, message: ->(obj, data) { "duplicate: #{Post.find_by_md5(obj.md5).id}"}
validates_inclusion_of :rating, in: %w(s q e), message: "rating must be s, q, or e"
validates :source, length: { maximum: 1200 }
validate :added_tags_are_valid
validate :removed_tags_are_valid
validate :has_artist_tag