mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
FEATURE: backend support for user-selectable components
* FEATURE: backend support for user-selectable components * fix problems with previewing default theme * rename preview_key => preview_theme_id * omit default theme from child themes dropdown and try a different fix * cache & freeze stylesheets arrays
This commit is contained in:
@ -359,9 +359,15 @@ class Guardian
|
||||
end
|
||||
|
||||
def allow_themes?(theme_ids)
|
||||
theme_ids = [theme_ids] unless theme_ids.is_a?(Array)
|
||||
allowed_ids = is_staff? ? Theme.theme_ids : Theme.user_theme_ids
|
||||
(theme_ids - allowed_ids.to_a).empty?
|
||||
if is_staff? && (theme_ids - Theme.theme_ids).blank?
|
||||
return true
|
||||
end
|
||||
|
||||
parent = theme_ids.first
|
||||
components = theme_ids[1..-1] || []
|
||||
|
||||
Theme.user_theme_ids.include?(parent) &&
|
||||
(components - Theme.components_for(parent)).empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
Reference in New Issue
Block a user