diff --git a/lib/text_sentinel.rb b/lib/text_sentinel.rb index f4361ebfb75..73e075fbcb0 100644 --- a/lib/text_sentinel.rb +++ b/lib/text_sentinel.rb @@ -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 diff --git a/spec/components/text_sentinel_spec.rb b/spec/components/text_sentinel_spec.rb index 669dc837fa6..15275e25a59 100644 --- a/spec/components/text_sentinel_spec.rb +++ b/spec/components/text_sentinel_spec.rb @@ -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" }