From a0090a4585c9275fd5987bf1d2b9bcfb2b2af5fc Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 21 May 2015 17:23:54 +1000 Subject: [PATCH] fix incorrect handling of date on "globally enabled" stylesheet. --- app/controllers/site_customizations_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/site_customizations_controller.rb b/app/controllers/site_customizations_controller.rb index e86fac11d0b..505e4aed2b2 100644 --- a/app/controllers/site_customizations_controller.rb +++ b/app/controllers/site_customizations_controller.rb @@ -4,7 +4,18 @@ class SiteCustomizationsController < ApplicationController def show cache_time = request.env["HTTP_IF_MODIFIED_SINCE"] cache_time = Time.rfc2822(cache_time) rescue nil if cache_time - stylesheet_time = SiteCustomization.where(key: params[:key].to_s).pluck(:created_at).first + stylesheet_time = + begin + if params[:key].to_s == SiteCustomization::ENABLED_KEY + SiteCustomization.where(enabled: true) + .order('created_at desc') + .limit(1) + .pluck(:created_at) + .first + else + SiteCustomization.where(key: params[:key].to_s).pluck(:created_at).first + end + end if !stylesheet_time raise Discourse::NotFound