mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:09:00 +08:00
FIX: Rebake theme fields if upload changes (#11341)
Updating SVG sprites of a theme did not take effect immediately because the cache was not cleared.
This commit is contained in:
parent
e527741577
commit
f9ff51870b
|
@ -483,7 +483,7 @@ class ThemeField < ActiveRecord::Base
|
|||
end
|
||||
|
||||
before_save do
|
||||
if will_save_change_to_value? && !will_save_change_to_value_baked?
|
||||
if (will_save_change_to_value? || will_save_change_to_upload_id?) && !will_save_change_to_value_baked?
|
||||
self.value_baked = nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -419,4 +419,15 @@ HTML
|
|||
end
|
||||
end
|
||||
|
||||
context "SVG sprite theme fields" do
|
||||
let(:upload) { Fabricate(:upload) }
|
||||
let(:theme) { Fabricate(:theme) }
|
||||
let(:theme_field) { ThemeField.create!(theme: theme, target_id: 0, name: SvgSprite.theme_sprite_variable_name, upload: upload, value: "", value_baked: "baked", type_id: ThemeField.types[:theme_upload_var]) }
|
||||
|
||||
it "is rebaked when upload changes" do
|
||||
theme_field.update(upload: Fabricate(:upload))
|
||||
expect(theme_field.value_baked).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user