mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Don't count HTML comments when calculating reply length. (#11658)
We'll remove them when we sanitize the post raw content.
This commit is contained in:
@@ -57,6 +57,24 @@ describe PostValidator do
|
||||
validator.stripped_length(post)
|
||||
expect(post.errors.count).to eq(0)
|
||||
end
|
||||
|
||||
it "ignores an html comment" do
|
||||
post.raw = "<!-- an html comment -->abc"
|
||||
validator.stripped_length(post)
|
||||
expect(post.errors.count).to eq(1)
|
||||
end
|
||||
|
||||
it "ignores multiple html comments" do
|
||||
post.raw = "<!-- an html comment -->\n abc \n<!-- a comment -->"
|
||||
validator.stripped_length(post)
|
||||
expect(post.errors.count).to eq(1)
|
||||
end
|
||||
|
||||
it "ignores nested html comments" do
|
||||
post.raw = "<!-- <!-- an html comment --> -->"
|
||||
validator.stripped_length(post)
|
||||
expect(post.errors.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
context "too_many_posts" do
|
||||
|
||||
Reference in New Issue
Block a user