Fix system theme being included twice (#37526)

This commit is contained in:
Claire authored and GitHub committed 2026-01-16 15:55:16 +00:00
1 parent e21cb9f0d0
commit cc3c7ba532
2 files changed
+7 -19

No files matched your search

+4 -8
View File
@@ -18,14 +18,10 @@ module ThemeHelper
end
def theme_style_tags(theme)
if theme == 'system'
''.html_safe.tap do |tags|
tags << vite_stylesheet_tag('themes/mastodon-light', type: :virtual, media: 'not all and (prefers-color-scheme: dark)', crossorigin: 'anonymous')
tags << vite_stylesheet_tag('themes/default', type: :virtual, media: '(prefers-color-scheme: dark)', crossorigin: 'anonymous')
end
else
vite_stylesheet_tag "themes/#{theme}", type: :virtual, media: 'all', crossorigin: 'anonymous'
end
# TODO: get rid of that when we retire the themes and perform the settings migration
theme = 'default' if %w(mastodon-light contrast system).include?(theme)
vite_stylesheet_tag "themes/#{theme}", type: :virtual, media: 'all', crossorigin: 'anonymous'
end
def theme_color_tags(color_scheme)
+3 -11
View File
@@ -9,17 +9,10 @@ RSpec.describe ThemeHelper do
context 'when using "system" theme' do
let(:theme) { 'system' }
it 'returns the mastodon-light and application stylesheets with correct color schemes' do
it 'returns the default theme' do
expect(html_links.first.attributes.symbolize_keys)
.to include(
# This is now identical to the default theme & will be unified very soon
href: have_attributes(value: match(/default/)),
media: have_attributes(value: 'not all and (prefers-color-scheme: dark)')
)
expect(html_links.last.attributes.symbolize_keys)
.to include(
href: have_attributes(value: match(/default/)),
media: have_attributes(value: '(prefers-color-scheme: dark)')
href: have_attributes(value: match(/default/))
)
end
end
@@ -41,8 +34,7 @@ RSpec.describe ThemeHelper do
it 'returns the theme stylesheet without color scheme information' do
expect(html_links.first.attributes.symbolize_keys)
.to include(
href: have_attributes(value: match(/default/)),
media: have_attributes(value: 'all')
href: have_attributes(value: match(/default/))
)
end
end