FIX: Wizard was creating duplicate Light theme if Light was selected (#9464)
This commit is contained in:
parent
7876ee2d67
commit
0a3cc22cec
|
@ -181,11 +181,16 @@ class Wizard
|
|||
next unless scheme_name.present? && ColorScheme.is_base?(scheme_name)
|
||||
|
||||
name = I18n.t("color_schemes.#{scheme_name.downcase.gsub(' ', '_')}_theme_name")
|
||||
|
||||
theme = nil
|
||||
scheme = ColorScheme.find_by(base_scheme_id: scheme_name, via_wizard: true)
|
||||
is_light_theme = (scheme_name == ColorScheme::LIGHT_THEME_ID)
|
||||
scheme ||= ColorScheme.create_from_base(name: name, via_wizard: true, base_scheme_id: scheme_name)
|
||||
|
||||
themes = Theme.where(color_scheme_id: scheme.id).order(:id).to_a
|
||||
if is_light_theme
|
||||
themes = (themes || []).concat(Theme.where(color_scheme_id: nil).order(:id).to_a)
|
||||
themes.sort_by(&:id)
|
||||
end
|
||||
theme = themes.find(&:default?)
|
||||
theme ||= themes.first
|
||||
|
||||
|
|
Loading…
Reference in New Issue