From 4881fb028f54b2bdce5a3faa498fc025fd08a460 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Mon, 8 Oct 2018 23:50:06 +0200 Subject: [PATCH] FIX: allow_uppercase_posts didn't work for topic titles --- lib/text_cleaner.rb | 2 +- spec/components/text_cleaner_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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