FIX: Error condition in SidebarSiteSettingsBackfiller (#19787)

This commit is contained in:
Alan Guo Xiang Tan 2023-01-09 07:01:58 +08:00 committed by GitHub
parent 72318a30ec
commit 673089a6b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -84,6 +84,8 @@ class SidebarSiteSettingsBackfiller
SQL SQL
end end
return 0 if select_statements.blank?
DB.query_single(<<~SQL)[0] DB.query_single(<<~SQL)[0]
SELECT SELECT
COUNT(*) COUNT(*)

View File

@ -226,6 +226,16 @@ RSpec.describe SidebarSiteSettingsBackfiller do
expect(backfiller.number_of_users_to_backfill).to eq(3) expect(backfiller.number_of_users_to_backfill).to eq(3)
end end
it "returns 0 for the user count when no new category is added or removed" do
backfiller = described_class.new(
"default_sidebar_categories",
previous_value: "",
new_value: ""
)
expect(backfiller.number_of_users_to_backfill).to eq(0)
end
end end
context 'for default_sidebar_tags setting' do context 'for default_sidebar_tags setting' do