mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Refactor theme fields so they support custom theme defined vars
This paves the way to allowing themes to specify uploads and so on.
This commit is contained in:
@@ -153,14 +153,14 @@ describe StaffActionLogger do
|
||||
it "logs updated site customizations" do
|
||||
old_json = ThemeSerializer.new(theme, root:false).to_json
|
||||
|
||||
theme.set_field(:common, :scss, "body{margin: 10px;}")
|
||||
theme.set_field(target: :common, name: :scss, value: "body{margin: 10px;}")
|
||||
|
||||
log_record = logger.log_theme_change(old_json, theme)
|
||||
|
||||
expect(log_record.previous_value).to be_present
|
||||
|
||||
json = ::JSON.parse(log_record.new_value)
|
||||
expect(json['theme_fields']).to eq([{"name" => "scss", "target" => "common", "value" => "body{margin: 10px;}"}])
|
||||
expect(json['theme_fields']).to eq([{"name" => "scss", "target" => "common", "value" => "body{margin: 10px;}", "type_id" => 1}])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -171,14 +171,14 @@ describe StaffActionLogger do
|
||||
|
||||
it "creates a new UserHistory record" do
|
||||
theme = Theme.new(name: 'Banana')
|
||||
theme.set_field(:common, :scss, "body{margin: 10px;}")
|
||||
theme.set_field(target: :common, name: :scss, value: "body{margin: 10px;}")
|
||||
|
||||
log_record = logger.log_theme_destroy(theme)
|
||||
expect(log_record.previous_value).to be_present
|
||||
expect(log_record.new_value).to eq(nil)
|
||||
json = ::JSON.parse(log_record.previous_value)
|
||||
|
||||
expect(json['theme_fields']).to eq([{"name" => "scss", "target" => "common", "value" => "body{margin: 10px;}"}])
|
||||
expect(json['theme_fields']).to eq([{"name" => "scss", "target" => "common", "value" => "body{margin: 10px;}", "type_id" => 1}])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user