mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Fix to prevent check for all upper case for non-ascii messages
This commit is contained in:
parent
b0cc45b14e
commit
876a570e3a
2 changed files with 18 additions and 1 deletions
|
@ -66,7 +66,7 @@ class TextSentinel
|
|||
|
||||
def seems_quiet?
|
||||
# We don't allow all upper case content in english
|
||||
not((@text =~ /[A-Z]+/) && (@text == @text.upcase))
|
||||
not((@text =~ /[A-Z]+/) && !(@text =~ /[^[:ascii:]]/) && (@text == @text.upcase))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -45,6 +45,23 @@ describe TextSentinel do
|
|||
|
||||
end
|
||||
|
||||
context 'body_sentinel' do
|
||||
[ 'evil trout is evil',
|
||||
"去年十社會警告",
|
||||
"P.S. Пробирочка очень толковая и весьма умная, так что не обнимайтесь.",
|
||||
"LOOK: 去年十社會警告"
|
||||
].each do |valid_body|
|
||||
it "handles a valid body in a private message" do
|
||||
expect(TextSentinel.body_sentinel(valid_body, private_message: true)).to be_valid
|
||||
end
|
||||
|
||||
it "handles a valid body in a public post" do
|
||||
expect(TextSentinel.body_sentinel(valid_body, private_message: false)).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "validity" do
|
||||
|
||||
let(:valid_string) { "This is a cool topic about Discourse" }
|
||||
|
|
Loading…
Reference in a new issue