diff --git a/lib/text_cleaner.rb b/lib/text_cleaner.rb index 0914fe88881..f258f906a33 100644 --- a/lib/text_cleaner.rb +++ b/lib/text_cleaner.rb @@ -12,7 +12,7 @@ class TextCleaner { deduplicate_exclamation_marks: SiteSetting.title_prettify, deduplicate_question_marks: SiteSetting.title_prettify, - replace_all_upper_case: SiteSetting.title_prettify, + replace_all_upper_case: SiteSetting.title_prettify && !SiteSetting.allow_uppercase_posts, capitalize_first_letter: SiteSetting.title_prettify, remove_all_periods_from_the_end: SiteSetting.title_prettify, remove_extraneous_space: SiteSetting.title_prettify && SiteSetting.default_locale == "en", diff --git a/spec/components/text_cleaner_spec.rb b/spec/components/text_cleaner_spec.rb index e4a4dd2a9fc..f9a9b10d3e7 100644 --- a/spec/components/text_cleaner_spec.rb +++ b/spec/components/text_cleaner_spec.rb @@ -180,6 +180,11 @@ describe TextCleaner do expect(TextCleaner.clean_title("HELLO THERE")).to eq("Hello there") end + it "doesn't replace all upper case text when uppercase posts are allowed" do + SiteSetting.allow_uppercase_posts = true + expect(TextCleaner.clean_title("HELLO THERE")).to eq("HELLO THERE") + end + it "capitalizes first letter" do expect(TextCleaner.clean_title("hello there")).to eq("Hello there") end