diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb index 0acf562..e6c43a1 100644 --- a/app/controllers/public/home_controller.rb +++ b/app/controllers/public/home_controller.rb @@ -4,7 +4,7 @@ class HomeController < PublicController @has_news = false if environment.enabled?('use_portal_community') && environment.portal_community @has_news = true - @news_cache_key = "home_page_news_#{environment.id.to_s}" + @news_cache_key = environment.portal_news_cache_key if !read_fragment(@news_cache_key) portal_community = environment.portal_community @portal_news = portal_community.news(5) diff --git a/app/models/environment.rb b/app/models/environment.rb index 71d095a..d1c5a63 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -658,6 +658,10 @@ class Environment < ActiveRecord::Base self.settings['tip_message_enterprise_activation_question'] = value end + def portal_news_cache_key + "home-page-news-#{id}_#{portal_community.name}" + end + after_create :create_templates def create_templates diff --git a/app/sweepers/article_sweeper.rb b/app/sweepers/article_sweeper.rb index 4037221..352aae8 100644 --- a/app/sweepers/article_sweeper.rb +++ b/app/sweepers/article_sweeper.rb @@ -22,7 +22,7 @@ protected blocks.map(&:cache_keys).each{|ck|expire_timeout_fragment(ck)} env = article.profile.environment if env.portal_community == article.profile - expire_fragment("home_page_news_#{env.id}") + expire_fragment(env.portal_news_cache_key) end end -- libgit2 0.21.2