fix incorrect handling of date on "globally enabled" stylesheet.

This commit is contained in:
Sam 2015-05-21 17:23:54 +10:00
parent 44fc8e42dc
commit a0090a4585
1 changed files with 12 additions and 1 deletions

View File

@ -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