mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Prevent users from converting the default theme to a component
This results in some fun disasters if allowed to happen. For now, just issue an oblique error message; a localized message will be added on the client.
This commit is contained in:
@ -401,8 +401,10 @@ class Admin::ThemesController < Admin::AdminController
|
||||
def handle_switch
|
||||
param = theme_params[:component]
|
||||
if param.to_s == "false" && @theme.component?
|
||||
raise Discourse::InvalidParameters.new(:component) if @theme.id == SiteSetting.default_theme_id
|
||||
@theme.switch_to_theme!
|
||||
elsif param.to_s == "true" && !@theme.component?
|
||||
raise Discourse::InvalidParameters.new(:component) if @theme.id == SiteSetting.default_theme_id
|
||||
@theme.switch_to_component!
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user