mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
FIX: admins bypass some post validations. This allows them to edit legal docs even if those docs are longer than max post length, for example.
This commit is contained in:
@ -3,14 +3,16 @@ module Validators; end
|
||||
class Validators::PostValidator < ActiveModel::Validator
|
||||
def validate(record)
|
||||
presence(record)
|
||||
stripped_length(record)
|
||||
raw_quality(record)
|
||||
max_posts_validator(record)
|
||||
max_mention_validator(record)
|
||||
max_images_validator(record)
|
||||
max_attachments_validator(record)
|
||||
max_links_validator(record)
|
||||
unique_post_validator(record)
|
||||
unless record.acting_user.try(:admin?)
|
||||
stripped_length(record)
|
||||
raw_quality(record)
|
||||
max_posts_validator(record)
|
||||
max_mention_validator(record)
|
||||
max_images_validator(record)
|
||||
max_attachments_validator(record)
|
||||
max_links_validator(record)
|
||||
unique_post_validator(record)
|
||||
end
|
||||
end
|
||||
|
||||
def presence(post)
|
||||
|
Reference in New Issue
Block a user