A platform for community discussion. Free, open, simple.
DEV: Make theme cache work like other caches (#20813)
Daniel Waterworth0728fa055b5b
diff --git a/app/models/theme.rb b/app/models/theme.rbindex 902219e03b5..8c3464b53b5 100644--- a/app/models/theme.rb+++ b/app/models/theme.rb@@ -10,7 +10,7 @@ class Theme < ActiveRecord::Baseattr_accessor :child_components- @cache = DistributedCache.new("theme:compiler#{BASE_COMPILER_VERSION}")+ @cache = DistributedCache.new("theme:compiler:#{BASE_COMPILER_VERSION}")belongs_to :userbelongs_to :color_scheme@@ -331,13 +331,11 @@ class Theme < ActiveRecord::Basetheme_ids = !skip_transformation ? transform_ids(theme_id) : [theme_id]cache_key = "#{theme_ids.join(",")}:#{target}:#{field}:#{Theme.compiler_version}"- lookup = @cache[cache_key]- return lookup.html_safe if lookup- target = target.to_sym- val = resolve_baked_field(theme_ids, target, field)-- get_set_cache(cache_key) { val || "" }.html_safe+ get_set_cache(cache_key) do+ target = target.to_sym+ resolve_baked_field(theme_ids, target, field) || ""+ end.html_safeenddef self.lookup_modifier(theme_ids, modifier_name)