mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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:
@@ -86,4 +86,22 @@ describe Validators::PostValidator do
|
||||
end
|
||||
end
|
||||
|
||||
context "acting_user is an admin" do
|
||||
before do
|
||||
post.acting_user = Fabricate(:admin)
|
||||
end
|
||||
|
||||
it "skips most validations" do
|
||||
validator.expects(:stripped_length).never
|
||||
validator.expects(:raw_quality).never
|
||||
validator.expects(:max_posts_validator).never
|
||||
validator.expects(:max_mention_validator).never
|
||||
validator.expects(:max_images_validator).never
|
||||
validator.expects(:max_attachments_validator).never
|
||||
validator.expects(:max_links_validator).never
|
||||
validator.expects(:unique_post_validator).never
|
||||
validator.validate(post)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user