A platform for community discussion. Free, open, simple.
DEV: enable Foundation and stop Default (#33508)
Krzysztof Kotlarek699f35aa70ac
diff --git a/app/controllers/admin/color_schemes_controller.rb b/app/controllers/admin/color_schemes_controller.rbindex 64059fa0d95..cc10ad72d01 100644--- a/app/controllers/admin/color_schemes_controller.rb+++ b/app/controllers/admin/color_schemes_controller.rb@@ -4,10 +4,7 @@ class Admin::ColorSchemesController < Admin::AdminControllerbefore_action :fetch_color_scheme, only: %i[update destroy]def index- schemes =- ColorScheme.without_theme_owned_palettes.with_experimental_system_theme_palettes.order(- "color_schemes.id ASC",- )+ schemes = ColorScheme.without_theme_owned_palettes.order("color_schemes.id ASC")schemes = schemes.where(theme_id: nil) if params[:exclude_theme_owned]diff --git a/app/controllers/admin/config/customize_controller.rb b/app/controllers/admin/config/customize_controller.rbindex d8ceffeade6..98ab25a8e43 100644--- a/app/controllers/admin/config/customize_controller.rb+++ b/app/controllers/admin/config/customize_controller.rb@@ -8,7 +8,6 @@ class Admin::Config::CustomizeController < Admin::AdminControllerTheme.include_basic_relations.includes(:theme_fields, color_scheme: [:color_scheme_colors])- .with_experimental_system_themes.where(component: false).order(:name)diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rbindex ea2f924773a..4f44175e50c 100644--- a/app/controllers/admin/themes_controller.rb+++ b/app/controllers/admin/themes_controller.rb@@ -170,14 +170,13 @@ class Admin::ThemesController < Admin::AdminControllerenddef index- @themes = Theme.with_experimental_system_themes.strict_loading.include_relations.order(:name)+ @themes = Theme.strict_loading.include_relations.order(:name)@color_schemes =ColorScheme.strict_loading.all.without_theme_owned_palettes- .with_experimental_system_theme_palettes.includes(:theme, color_scheme_colors: :color_scheme).to_adiff --git a/app/models/color_scheme.rb b/app/models/color_scheme.rbindex d01282deb3b..3f4a384c61e 100644--- a/app/models/color_scheme.rb+++ b/app/models/color_scheme.rb@@ -318,14 +318,6 @@ class ColorScheme < ActiveRecord::Basescope :without_theme_owned_palettes,-> { where("color_schemes.id NOT IN (SELECT color_scheme_id FROM theme_color_schemes)") }- scope :with_experimental_system_theme_palettes,- -> do- joins("LEFT JOIN themes on themes.id = color_schemes.theme_id").where(- "themes.id is NULL OR themes.id > 0 OR themes.id IN (?)",- Theme.experimental_system_theme_ids,- )- end-validates_associated :color_scheme_colorsBASE_COLORS_FILE = "#{Rails.root}/app/assets/stylesheets/common/foundation/colors.scss"diff --git a/app/models/theme.rb b/app/models/theme.rbindex 557b4c4dc7e..4ce9670b1d5 100644--- a/app/models/theme.rb+++ b/app/models/theme.rb@@ -128,8 +128,6 @@ class Theme < ActiveRecord::Basescope :not_system, -> { where("id > 0") }scope :system, -> { where("id < 0") }- scope :with_experimental_system_themes,- -> { where("id > 0 OR id IN (?)", Theme.experimental_system_theme_ids) }delegate :remote_url, to: :remote_theme, private: true, allow_nil: true@@ -348,12 +346,6 @@ class Theme < ActiveRecord::Baseendend- def self.experimental_system_theme_ids- Theme::CORE_THEMES- .select { |k, v| SiteSetting.experimental_system_themes_map.include?(k) }- .values- end-def set_default!if componentraise Discourse::InvalidParameters.new(I18n.t("themes.errors.component_no_default"))diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 18f51a8fb1e..3841b2ce558 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -4677,7 +4677,6 @@ en:solarized_dark_theme_name: "Solarized Dark"wcag_dark: "WCAG Dark"wcag_dark_theme_name: "WCAG Dark"- default_theme_name: "Default"light_theme_name: "Light"dark_theme_name: "Dark"neutral_theme_name: "Neutral"diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 707faf24562..d7d667c4288 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -4071,11 +4071,3 @@ experimental:client: truetype: group_listdefault: ""- experimental_system_themes:- type: list- default: "horizon"- hidden: true- allow_any: false- choices:- - "foundation"- - "horizon"diff --git a/db/fixtures/600_themes.rb b/db/fixtures/600_themes.rbindex aad0ec1e7f6..1994be3ccdc 100644--- a/db/fixtures/600_themes.rb+++ b/db/fixtures/600_themes.rb@@ -1,7 +1,11 @@# frozen_string_literal: true+theme_exists = Theme.exists?++SystemThemesManager.sync!+# we can not guess what to do if customization already started, so skip it-if !Theme.exists?+if !theme_existsSTDERR.puts "> Seeding theme and color schemes"color_schemes = [@@ -24,9 +28,7 @@ if !Theme.exists?)end- name = I18n.t("color_schemes.default_theme_name")- default_theme = Theme.create!(name: name, user_id: Discourse::SYSTEM_USER_ID)- default_theme.set_default!+ Theme.foundation_theme.set_default!if SiteSetting.default_dark_mode_color_scheme_id ==SiteSetting.defaults[:default_dark_mode_color_scheme_id]@@ -35,5 +37,3 @@ if !Theme.exists?SiteSetting.default_dark_mode_color_scheme_id = dark_scheme_id if dark_scheme_id.present?endend--SystemThemesManager.sync!diff --git a/db/migrate/20250714030525_remove_experimental_system_themes_site_setting.rb b/db/migrate/20250714030525_remove_experimental_system_themes_site_setting.rbnew file mode 100644index 00000000000..e8ff544bf64--- /dev/null+++ b/db/migrate/20250714030525_remove_experimental_system_themes_site_setting.rb@@ -0,0 +1,10 @@+# frozen_string_literal: true+class RemoveExperimentalSystemThemesSiteSetting < ActiveRecord::Migration[7.2]+ def up+ execute "DELETE FROM site_settings WHERE name = 'experimental_system_themes'"+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/spec/models/theme_spec.rb b/spec/models/theme_spec.rbindex a0e6c81fc93..a45dee0c66c 100644--- a/spec/models/theme_spec.rb+++ b/spec/models/theme_spec.rb@@ -234,7 +234,7 @@ HTMLf =ThemeField.create!(target_id: Theme.targets[:mobile],- theme_id: 1,+ theme_id: -1,name: "after_header",value: html,)diff --git a/spec/requests/admin/color_schemes_controller_spec.rb b/spec/requests/admin/color_schemes_controller_spec.rbindex 5a474d4d977..3bcef138cd1 100644--- a/spec/requests/admin/color_schemes_controller_spec.rb+++ b/spec/requests/admin/color_schemes_controller_spec.rb@@ -32,20 +32,6 @@ RSpec.describe Admin::ColorSchemesController doexpect(scheme_colors[0]["hex"]).to eq(base_scheme_colors[0].hex)end- it "filters colors belonging to experimental system themes" do- SiteSetting.experimental_system_themes = ""- get "/admin/color_schemes.json"- expect(response.status).to eq(200)- scheme_names = response.parsed_body.map { |scheme| scheme["name"] }- expect(scheme_names).not_to include("Horizon")-- SiteSetting.experimental_system_themes = "horizon"- get "/admin/color_schemes.json"- expect(response.status).to eq(200)- scheme_names = response.parsed_body.map { |scheme| scheme["name"] }- expect(scheme_names).to include("Horizon")- end-it "serializes default colors even when not present in database" doscheme = ColorScheme.create_from_base({ name: "my color scheme" })scheme.colors.find_by(name: "primary").destroy!diff --git a/spec/requests/admin/themes_controller_spec.rb b/spec/requests/admin/themes_controller_spec.rbindex ef0ed36b55c..5836b44a805 100644--- a/spec/requests/admin/themes_controller_spec.rb+++ b/spec/requests/admin/themes_controller_spec.rb@@ -510,26 +510,6 @@ RSpec.describe Admin::ThemesController doexpect(theme_json["remote_theme"]["remote_version"]).to eq("7")end- it "filters experimental system themes" do- SiteSetting.experimental_system_themes = ""- get "/admin/themes.json"- expect(response.status).to eq(200)- theme_names = response.parsed_body["themes"].map { |theme| theme[:name] }- color_scheme_names =- response.parsed_body["extras"]["color_schemes"].map { |scheme| scheme[:name] }- expect(theme_names).not_to include("Horizon")- expect(color_scheme_names).not_to include("Horizon")-- SiteSetting.experimental_system_themes = "horizon"- get "/admin/themes.json"- expect(response.status).to eq(200)- theme_names = response.parsed_body["themes"].map { |t| t[:name] }- color_scheme_names =- response.parsed_body["extras"]["color_schemes"].map { |scheme| scheme[:name] }- expect(theme_names).to include("Horizon")- expect(color_scheme_names).to include("Horizon")- end-it "does not result in N+1 queries" do# warmupget "/admin/themes.json"diff --git a/spec/system/admin_customize_themes_config_area_spec.rb b/spec/system/admin_customize_themes_config_area_spec.rbindex bd771acfe2d..152163cfe9e 100644--- a/spec/system/admin_customize_themes_config_area_spec.rb+++ b/spec/system/admin_customize_themes_config_area_spec.rb@@ -3,8 +3,8 @@describe "Admin Customize Themes Config Area Page", type: :system dofab!(:admin)fab!(:theme) { Fabricate(:theme, name: "First theme") }- fab!(:default_theme) { Theme.where(component: false, name: "Default").first }fab!(:foundation_theme) { Theme.foundation_theme }+ fab!(:horizon_theme) { Theme.horizon_theme }fab!(:theme_child_theme) doFabricate(:theme, name: "Child theme", component: true, enabled: true, parent_themes: [theme])end@@ -14,10 +14,7 @@ describe "Admin Customize Themes Config Area Page", type: :system dolet(:install_modal) { PageObjects::Modals::InstallTheme.new }let(:admin_customize_themes_page) { PageObjects::Pages::AdminCustomizeThemes.new }- before do- SiteSetting.experimental_system_themes = "foundation|horizon"- sign_in(admin)- end+ before { sign_in(admin) }it "has an install button in the subheader" doconfig_area.visit@@ -42,14 +39,11 @@ describe "Admin Customize Themes Config Area Page", type: :system doit "allows to mark theme as active" doconfig_area.visit- expect(config_area).to have_badge(default_theme, "--active")+ expect(config_area).to have_badge(foundation_theme, "--active")expect(config_area).to have_no_badge(theme_2, "--active")config_area.mark_as_active(theme_2)expect(config_area).to have_badge(theme_2, "--active")expect(config_area).to have_no_badge(foundation_theme, "--active")- expect(config_area).to have_themes(- ["Second theme", "Horizon", "Foundation", "Default", "First theme"],- )endit "allows to make theme selectable by users" do@@ -81,20 +75,4 @@ describe "Admin Customize Themes Config Area Page", type: :system doI18n.t("admin_js.admin.config_areas.themes_and_components.themes.title"),)end-- it "allows controlling visibility of system themes with experimental_system_themes setting" do- SiteSetting.experimental_system_themes = ""- config_area.visit- expect(config_area).to have_themes(["Default", "First theme", "Second theme"])-- SiteSetting.experimental_system_themes = "foundation"- config_area.visit- expect(config_area).to have_themes(["Default", "Foundation", "First theme", "Second theme"])-- SiteSetting.experimental_system_themes = "foundation|horizon"- config_area.visit- expect(config_area).to have_themes(- ["Default", "Horizon", "Foundation", "First theme", "Second theme"],- )- endend