diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index a6e3d0d9f..df50a00c3 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1059,6 +1059,7 @@ en: title_max_word_length: "The maximum allowed word length, in characters, in a topic title." title_min_entropy: "The minimum entropy (unique characters, non-english count for more) required for a topic title." body_min_entropy: "The minimum entropy (unique characters, non-english count for more) required for a post body." + allow_uppercase_posts: "Allow all caps in a topic title or a post body." title_fancy_entities: "Convert common ASCII characters to fancy HTML entities in topic titles, ala SmartyPants http://daringfireball.net/projects/smartypants/" diff --git a/config/site_settings.yml b/config/site_settings.yml index d2f427f88..e5583b231 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -377,6 +377,7 @@ posting: default: 255 max: 255 title_min_entropy: 10 + allow_uppercase_posts: false title_prettify: true title_fancy_entities: true min_private_message_title_length: diff --git a/lib/text_sentinel.rb b/lib/text_sentinel.rb index 1210ad379..8e01a5888 100644 --- a/lib/text_sentinel.rb +++ b/lib/text_sentinel.rb @@ -73,7 +73,7 @@ class TextSentinel def seems_quiet? # We don't allow all upper case content in english - not((@text =~ /[A-Z]+/) && !(@text =~ /[^[:ascii:]]/) && (@text == @text.upcase)) + SiteSetting.allow_uppercase_posts || 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 cd9e41d66..c93df22aa 100644 --- a/spec/components/text_sentinel_spec.rb +++ b/spec/components/text_sentinel_spec.rb @@ -74,6 +74,11 @@ describe TextSentinel do expect(TextSentinel.new(valid_string.upcase)).not_to be_valid end + it "allows all caps topics when loud posts are allowed" do + SiteSetting.stubs(:allow_uppercase_posts).returns(true) + expect(TextSentinel.new(valid_string.upcase)).to be_valid + end + it "enforces the minimum entropy" do expect(TextSentinel.new(valid_string, min_entropy: 16)).to be_valid end