mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 14:38:30 +08:00
FIX: Update digest when updating color definitions in theme component (#12233)
This commit is contained in:
parent
cf0192018e
commit
bfa3e24e48
|
@ -371,7 +371,7 @@ class Theme < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def list_baked_fields(target, name)
|
def list_baked_fields(target, name)
|
||||||
theme_ids = Theme.transform_ids([id], extend: false)
|
theme_ids = Theme.transform_ids([id], extend: name == :color_definitions)
|
||||||
self.class.list_baked_fields(theme_ids, target, name)
|
self.class.list_baked_fields(theme_ids, target, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -247,10 +247,30 @@ describe Stylesheet::Manager do
|
||||||
theme.save!
|
theme.save!
|
||||||
|
|
||||||
digest2 = manager.color_scheme_digest
|
digest2 = manager.color_scheme_digest
|
||||||
|
|
||||||
expect(digest1).to_not eq(digest2)
|
expect(digest1).to_not eq(digest2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "updates digest when updating a theme component's color definitions" do
|
||||||
|
scheme = ColorScheme.base
|
||||||
|
manager = Stylesheet::Manager.new(:color_definitions, theme.id, scheme)
|
||||||
|
digest1 = manager.color_scheme_digest
|
||||||
|
|
||||||
|
child_theme = Fabricate(:theme, component: true)
|
||||||
|
child_theme.set_field(target: :common, name: "color_definitions", value: 'body {color: fuchsia}')
|
||||||
|
child_theme.save!
|
||||||
|
theme.add_relative_theme!(:child, child_theme)
|
||||||
|
theme.save!
|
||||||
|
|
||||||
|
digest2 = manager.color_scheme_digest
|
||||||
|
expect(digest1).to_not eq(digest2)
|
||||||
|
|
||||||
|
child_theme.set_field(target: :common, name: "color_definitions", value: 'body {color: blue}')
|
||||||
|
child_theme.save!
|
||||||
|
digest3 = manager.color_scheme_digest
|
||||||
|
expect(digest2).to_not eq(digest3)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
it "updates digest when setting fonts" do
|
it "updates digest when setting fonts" do
|
||||||
manager = Stylesheet::Manager.new(:desktop_theme, theme.id)
|
manager = Stylesheet::Manager.new(:desktop_theme, theme.id)
|
||||||
digest1 = manager.color_scheme_digest
|
digest1 = manager.color_scheme_digest
|
||||||
|
|
Loading…
Reference in New Issue
Block a user