FIX: Clear stylesheet cache on base font change

FIX: Clear stylesheet cache on base font change

Previously, we were not clearing the cache on themes using the default color scheme.

diff --git a/config/initializers/014-track-setting-changes.rb b/config/initializers/014-track-setting-changes.rb
index e6c8dc4..9e0b13c 100644
--- a/config/initializers/014-track-setting-changes.rb
+++ b/config/initializers/014-track-setting-changes.rb
@@ -27,7 +27,7 @@ DiscourseEvent.on(:site_setting_changed) do |name, old_value, new_value|
     end
   end
 
-  Stylesheet::Manager.clear_core_cache!(["desktop", "mobile", "admin"]) if name == :base_font
+  Stylesheet::Manager.clear_core_cache!(["desktop", "mobile"]) if name == :base_font
 
   Report.clear_cache(:storage_stats) if [:backup_location, :s3_backup_bucket].include?(name)
 
diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rb
index 847de64..816a98a 100644
--- a/lib/stylesheet/manager.rb
+++ b/lib/stylesheet/manager.rb
@@ -411,7 +411,7 @@ class Stylesheet::Manager
       theme_color_defs = theme&.resolve_baked_field(:common, :color_definitions)
       Digest::SHA1.hexdigest "#{RailsMultisite::ConnectionManagement.current_db}-#{cs&.id}-#{cs&.version}-#{theme_color_defs}-#{Stylesheet::Manager.last_file_updated}-#{category_updated}-#{SiteSetting.base_font}"
     else
-      digest_string = "defaults-#{Stylesheet::Manager.last_file_updated}"
+      digest_string = "defaults-#{Stylesheet::Manager.last_file_updated}-#{SiteSetting.base_font}"
 
       if cdn_url = GlobalSetting.cdn_url
         digest_string = "#{digest_string}-#{cdn_url}"
diff --git a/spec/components/stylesheet/manager_spec.rb b/spec/components/stylesheet/manager_spec.rb
index 1a6f493..e25c1f8 100644
--- a/spec/components/stylesheet/manager_spec.rb
+++ b/spec/components/stylesheet/manager_spec.rb
@@ -143,8 +143,8 @@ describe Stylesheet::Manager do
   end
 
   describe 'color_scheme_digest' do
+    let(:theme) { Fabricate(:theme) }
     it "changes with category background image" do
-      theme = Fabricate(:theme)
       category1 = Fabricate(:category, uploaded_background_id: 123, updated_at: 1.week.ago)
       category2 = Fabricate(:category, uploaded_background_id: 456, updated_at: 2.days.ago)
 
@@ -178,7 +178,6 @@ describe Stylesheet::Manager do
 
     it "updates digest when updating a theme's color definitions" do
       scheme = ColorScheme.base
-      theme = Fabricate(:theme)
       manager = Stylesheet::Manager.new(:color_definitions, theme.id, scheme)
       digest1 = manager.color_scheme_digest
 
@@ -190,6 +189,15 @@ describe Stylesheet::Manager do
       expect(digest1).to_not eq(digest2)
     end
 
+    it "updates digest when setting base font" do
+      manager = Stylesheet::Manager.new(:desktop_theme, theme.id)
+      digest1 = manager.color_scheme_digest
+      SiteSetting.base_font = "nunito"
+      digest2 = manager.color_scheme_digest
+
+      expect(digest1).to_not eq(digest2)
+    end
+
   end
 
   describe 'color_scheme_stylesheets' do

GitHub sha: 6610576d