Skip to content

A platform for community discussion. Free, open, simple.

UX: Don't make seeded palettes user-selectable (#34347)

Osama Sayegh77b774e7b3b8
diff --git a/app/models/color_scheme.rb b/app/models/color_scheme.rb
index 1c1c41f11f7..92297dc4101 100644
--- a/app/models/color_scheme.rb
+++ b/app/models/color_scheme.rb
@@ -402,7 +402,6 @@ class ColorScheme < ActiveRecord::Base
new_color_scheme = new(name: params[:name])
new_color_scheme.via_wizard = true if params[:via_wizard]
new_color_scheme.base_scheme_id = params[:base_scheme_id]
- new_color_scheme.user_selectable = true
colors =
BUILT_IN_SCHEMES[params[:base_scheme_id].to_sym]&.map do |name, hex|
diff --git a/db/fixtures/600_themes.rb b/db/fixtures/600_themes.rb
index 75e97b40c9a..5a95e8f7187 100644
--- a/db/fixtures/600_themes.rb
+++ b/db/fixtures/600_themes.rb
@@ -24,7 +24,6 @@ if !theme_exists
name: cs[:name],
via_wizard: true,
base_scheme_id: cs[:base_scheme_id],
- user_selectable: true,
)
end
diff --git a/spec/lib/stylesheet/manager_spec.rb b/spec/lib/stylesheet/manager_spec.rb
index d655ab8d1bc..3474847a8fa 100644
--- a/spec/lib/stylesheet/manager_spec.rb
+++ b/spec/lib/stylesheet/manager_spec.rb
@@ -979,7 +979,7 @@ RSpec.describe Stylesheet::Manager do
# Ensure we force compile each theme only once
expect(output.scan(/#{child_theme_with_css.name}/).length).to eq(2) # ltr/rtl
- expect(StylesheetCache.count).to eq(34) # (1 theme with rtl/ltr) + 32 color schemes (2 themes * 8 color schemes (7 defaults + 1 theme scheme) * 2 (light and dark mode per scheme))
+ expect(StylesheetCache.count).to eq(10) # (2 theme with rtl/ltr) + 8 color schemes (2 themes * 2 color schemes (1 base light palette + 1 theme scheme) * 2 (light and dark mode per scheme))
end
it "generates precompiled CSS - core and themes" do
@@ -987,7 +987,7 @@ RSpec.describe Stylesheet::Manager do
Stylesheet::Manager.precompile_theme_css
results = StylesheetCache.pluck(:target)
- expect(results.size).to eq(44) # 10 core targets + 2 theme (ltr/rtl) + 32 color schemes (light and dark mode per scheme)
+ expect(results.size).to eq(20) # 10 core targets + 2 theme (ltr/rtl) + 8 color schemes (light and dark mode per scheme)
expect(results.count { |target| target =~ /^common_theme_/ }).to eq(2) # ltr/rtl
end
@@ -999,7 +999,7 @@ RSpec.describe Stylesheet::Manager do
Stylesheet::Manager.precompile_theme_css
results = StylesheetCache.pluck(:target)
- expect(results.size).to eq(58) # 10 core targets + theme rtl/ltr + 32 color schemes (light and dark mode per scheme) + 14 Foundation
+ expect(results.size).to eq(24) # 10 core targets + 2 theme rtl/ltr + 12 color schemes (light and dark mode per scheme)
expect(results).to include("color_definitions_#{scheme1.name}_#{scheme1.id}_#{user_theme.id}")
expect(results).to include(
diff --git a/spec/serializers/site_serializer_spec.rb b/spec/serializers/site_serializer_spec.rb
index 4478b465e4b..28ec199b5d0 100644
--- a/spec/serializers/site_serializer_spec.rb
+++ b/spec/serializers/site_serializer_spec.rb
@@ -88,24 +88,12 @@ RSpec.describe SiteSerializer do
end
it "includes user-selectable color schemes" do
- # it includes seeded color schemes
- serialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json
- expect(serialized[:user_color_schemes].count).to eq(6)
-
- scheme_names = serialized[:user_color_schemes].map { |x| x[:name] }
- expect(scheme_names).to include(I18n.t("color_schemes.dark"))
- expect(scheme_names).to include(I18n.t("color_schemes.wcag"))
- expect(scheme_names).to include(I18n.t("color_schemes.wcag_dark"))
- expect(scheme_names).to include(I18n.t("color_schemes.solarized_light"))
- expect(scheme_names).to include(I18n.t("color_schemes.solarized_dark"))
- expect(scheme_names).to include(I18n.t("color_schemes.dracula"))
-
dark_scheme = ColorScheme.create_from_base(name: "AnotherDarkScheme", base_scheme_id: "Dark")
dark_scheme.user_selectable = true
dark_scheme.save!
serialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json
- expect(serialized[:user_color_schemes].count).to eq(7)
+ expect(serialized[:user_color_schemes].count).to eq(1)
expect(serialized[:user_color_schemes][0][:is_dark]).to eq(true)
end