mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 12:02:59 +08:00
FIX: embedded comments not working when theme is missing
This commit is contained in:
parent
b4b864047c
commit
e119c6e01e
|
@ -41,10 +41,14 @@ class Stylesheet::Manager
|
||||||
|
|
||||||
@lock.synchronize do
|
@lock.synchronize do
|
||||||
builder = self.new(target, theme_key)
|
builder = self.new(target, theme_key)
|
||||||
|
if builder.is_theme? && !builder.theme
|
||||||
|
tag = ""
|
||||||
|
else
|
||||||
builder.compile unless File.exists?(builder.stylesheet_fullpath)
|
builder.compile unless File.exists?(builder.stylesheet_fullpath)
|
||||||
tag = %[<link href="#{builder.stylesheet_path}" media="#{media}" rel="stylesheet" data-target="#{target}"/>]
|
tag = %[<link href="#{builder.stylesheet_path}" media="#{media}" rel="stylesheet" data-target="#{target}"/>]
|
||||||
cache[cache_key] = tag
|
end
|
||||||
|
|
||||||
|
cache[cache_key] = tag
|
||||||
tag.dup.html_safe
|
tag.dup.html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,18 @@ require 'rails_helper'
|
||||||
require 'stylesheet/compiler'
|
require 'stylesheet/compiler'
|
||||||
|
|
||||||
describe Stylesheet::Manager do
|
describe Stylesheet::Manager do
|
||||||
|
|
||||||
|
it 'does not crash for missing theme' do
|
||||||
|
link = Stylesheet::Manager.stylesheet_link_tag(:embedded_theme)
|
||||||
|
expect(link).to eq("")
|
||||||
|
|
||||||
|
theme = Theme.create(name: "embedded", user_id: -1)
|
||||||
|
SiteSetting.default_theme_key = theme.key
|
||||||
|
|
||||||
|
link = Stylesheet::Manager.stylesheet_link_tag(:embedded_theme)
|
||||||
|
expect(link).not_to eq("")
|
||||||
|
end
|
||||||
|
|
||||||
it 'can correctly compile theme css' do
|
it 'can correctly compile theme css' do
|
||||||
theme = Theme.new(
|
theme = Theme.new(
|
||||||
name: 'parent',
|
name: 'parent',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user