FIX: expire stylesheet cache on save

This commit is contained in:
Sam 2014-11-21 08:32:16 +11:00
parent 97a44b4c43
commit 4a7e0416d1
2 changed files with 5 additions and 0 deletions

View file

@ -1,3 +1,5 @@
require_dependency 'sass/discourse_stylesheets'
class ColorScheme < ActiveRecord::Base class ColorScheme < ActiveRecord::Base
attr_accessor :is_base attr_accessor :is_base
@ -96,6 +98,7 @@ class ColorScheme < ActiveRecord::Base
def publish_discourse_stylesheet def publish_discourse_stylesheet
MessageBus.publish("/discourse_stylesheet", self.name) MessageBus.publish("/discourse_stylesheet", self.name)
DiscourseStylesheets.cache.clear
end end
end end

View file

@ -1,4 +1,5 @@
require_dependency 'sass/discourse_sass_compiler' require_dependency 'sass/discourse_sass_compiler'
require_dependency 'sass/discourse_stylesheets'
class SiteCustomization < ActiveRecord::Base class SiteCustomization < ActiveRecord::Base
ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd' ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd'
@ -43,6 +44,7 @@ class SiteCustomization < ActiveRecord::Base
end end
MessageBus.publish "/header-change/#{key}", header if header_changed? MessageBus.publish "/header-change/#{key}", header if header_changed?
MessageBus.publish "/footer-change/#{key}", footer if footer_changed? MessageBus.publish "/footer-change/#{key}", footer if footer_changed?
DiscourseStylesheets.cache.clear
end end
after_destroy do after_destroy do