FIX: allow_uppercase_posts didn't work for topic titles

This commit is contained in:
Gerhard Schlager 2018-10-08 23:50:06 +02:00
parent c889c0daee
commit 4881fb028f
2 changed files with 6 additions and 1 deletions

View File

@ -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",

View File

@ -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