mirror of
https://github.com/discourse/discourse.git
synced 2025-05-20 10:13:07 +08:00
DEV: Account for relative url root in Stylesheet::Manager
cache keys (#32487)
This is mainly used for the test environment where `Discourse.current_hostname` and `GlobalSetting.relative_url_root` can be stubbed. ### Reviewer notes We don't really need a test here since this doesn't really affect the production environment.
This commit is contained in:
parent
621e095739
commit
84c8f51c54
@ -46,7 +46,7 @@ class Stylesheet::Manager
|
|||||||
color_scheme_name = Slug.for(color_scheme.name) + color_scheme&.id.to_s
|
color_scheme_name = Slug.for(color_scheme.name) + color_scheme&.id.to_s
|
||||||
theme_string = theme_id ? "_theme#{theme_id}" : ""
|
theme_string = theme_id ? "_theme#{theme_id}" : ""
|
||||||
dark_string = dark ? "_dark" : ""
|
dark_string = dark ? "_dark" : ""
|
||||||
"#{COLOR_SCHEME_STYLESHEET}_#{color_scheme_name}_#{theme_string}_#{Discourse.current_hostname}#{dark_string}"
|
"#{COLOR_SCHEME_STYLESHEET}_#{color_scheme_name}_#{theme_string}_#{Discourse.current_hostname}_#{GlobalSetting.relative_url_root}_#{dark_string}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.precompile_css
|
def self.precompile_css
|
||||||
@ -285,14 +285,15 @@ class Stylesheet::Manager
|
|||||||
def stylesheet_details(target = :desktop, media = "all")
|
def stylesheet_details(target = :desktop, media = "all")
|
||||||
target = target.to_sym
|
target = target.to_sym
|
||||||
current_hostname = Discourse.current_hostname
|
current_hostname = Discourse.current_hostname
|
||||||
|
relative_url_root = GlobalSetting.relative_url_root
|
||||||
is_theme_target = !!(target.to_s =~ THEME_REGEX)
|
is_theme_target = !!(target.to_s =~ THEME_REGEX)
|
||||||
|
|
||||||
array_cache_key =
|
array_cache_key =
|
||||||
(
|
(
|
||||||
if is_theme_target
|
if is_theme_target
|
||||||
"array_themes_#{@theme_ids.join(",")}_#{target}_#{current_hostname}"
|
"array_themes_#{@theme_ids.join(",")}_#{target}_#{current_hostname}_#{relative_url_root}"
|
||||||
else
|
else
|
||||||
"array_#{target}_#{current_hostname}"
|
"array_#{target}_#{current_hostname}_#{relative_url_root}"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user