From ed6f7b1e6d9ead915530a7bd193566286889d1c6 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Fri, 24 Mar 2023 11:40:37 +0530 Subject: [PATCH] FIX: use correct validation method name for `default_categories_normal`. (#20801) When we renamed the `default_categories_regular` to `default_categories_normal` we missed a site setting validation method. It allowed the duplicate category ids in `default_categories_normal` site setting and caused the problem in user registration process. https://github.com/discourse/discourse/commit/5176c689e953f3c91abf97ec45cd528ef36cdee1 --- lib/site_settings/validations.rb | 2 +- spec/lib/site_settings/validations_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/site_settings/validations.rb b/lib/site_settings/validations.rb index f2890805e4c..b048ed2ca9e 100644 --- a/lib/site_settings/validations.rb +++ b/lib/site_settings/validations.rb @@ -96,7 +96,7 @@ module SiteSettings::Validations validate_default_categories(category_ids, default_categories_selected) end - def validate_default_categories_regular(new_val) + def validate_default_categories_normal(new_val) category_ids = validate_category_ids(new_val) default_categories_selected = [ diff --git a/spec/lib/site_settings/validations_spec.rb b/spec/lib/site_settings/validations_spec.rb index fea8230d8c6..3822274306c 100644 --- a/spec/lib/site_settings/validations_spec.rb +++ b/spec/lib/site_settings/validations_spec.rb @@ -28,6 +28,10 @@ RSpec.describe SiteSettings::Validations do expect { SiteSetting.default_categories_tracking = "#{category.id}" }.to raise_error( Discourse::InvalidParameters, ) + + expect { SiteSetting.default_categories_normal = "#{category.id}" }.to raise_error( + Discourse::InvalidParameters, + ) end end