refactor validators

add a new setting for min pm body length
use that setting for flags
scale entropy check down for pms
This commit is contained in:
Sam
2013-06-13 18:18:17 +10:00
parent b027f7d8da
commit f7de9f17d5
12 changed files with 91 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ require_dependency 'post_revisor'
require_dependency 'enum'
require_dependency 'trashable'
require_dependency 'post_analyzer'
require_dependency 'validators/post_validator'
require 'archetype'
require 'digest/sha1'
@@ -17,7 +18,6 @@ class Post < ActiveRecord::Base
rate_limit
belongs_to :user
belongs_to :topic, counter_cache: :posts_count
belongs_to :reply_to_user, class_name: "User"
@@ -28,9 +28,7 @@ class Post < ActiveRecord::Base
has_one :post_search_data
validates_presence_of :raw, :user_id, :topic_id
validates :raw, stripped_length: { in: -> { SiteSetting.post_length } }
validates_with PostValidator
validates_with ::Validators::PostValidator
# We can pass a hash of image sizes when saving to prevent crawling those images
attr_accessor :image_sizes, :quoted_post_numbers, :no_bump, :invalidate_oneboxes