From ae7b2c47a6e28498cda6194f8fa4e5b4a9521b8f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 18 Jun 2021 11:29:19 +0200 Subject: [PATCH] PreferenceForm: Really only reload CSS or redirect if required --- application/forms/PreferenceForm.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index 10c3abcc0..777e6f3a3 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -96,13 +96,14 @@ class PreferenceForm extends Form $oldTheme = $this->preferences->getValue('icingaweb', 'theme'); $oldLocale = $this->preferences->getValue('icingaweb', 'language'); + $defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME); $webPreferences = $this->preferences->get('icingaweb', array()); foreach ($this->getValues() as $key => $value) { if ($value === '' || $value === null || $value === 'autodetect' - || ($key === 'theme' && $value === Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME)) + || ($key === 'theme' && $value === $defaultTheme) ) { if (isset($webPreferences[$key])) { unset($webPreferences[$key]); @@ -117,11 +118,13 @@ class PreferenceForm extends Form if (($theme = $this->getElement('theme')) !== null && ($theme = $theme->getValue()) !== $oldTheme + && ($theme !== $defaultTheme || $oldTheme !== null) ) { $this->getResponse()->setReloadCss(true); } if (($locale = $this->getElement('language')) !== null + && $locale->getValue() !== 'autodetect' && $locale->getValue() !== $oldLocale ) { $this->getResponse()->setHeader('X-Icinga-Redirect-Http', 'yes');