From 4ba0fb102fece0270fbe860ccb0c057473a40742 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Fri, 18 Jun 2021 12:18:21 +0200 Subject: [PATCH] PreferencesForm : Reload CSS if theme mode changed --- application/forms/PreferenceForm.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index 777e6f3a3..30c0c1fda 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -93,8 +93,8 @@ class PreferenceForm extends Form public function onSuccess() { $this->preferences = new Preferences($this->store ? $this->store->load() : array()); - $oldTheme = $this->preferences->getValue('icingaweb', 'theme'); + $oldMode = $this->preferences->getValue('icingaweb', 'theme_mode'); $oldLocale = $this->preferences->getValue('icingaweb', 'language'); $defaultTheme = Config::app()->get('themes', 'default', StyleSheet::DEFAULT_THEME); @@ -113,12 +113,13 @@ class PreferenceForm extends Form } } $this->preferences->icingaweb = $webPreferences; - Session::getSession()->user->setPreferences($this->preferences); - if (($theme = $this->getElement('theme')) !== null + if ((($theme = $this->getElement('theme')) !== null && ($theme = $theme->getValue()) !== $oldTheme - && ($theme !== $defaultTheme || $oldTheme !== null) + && ($theme !== $defaultTheme || $oldTheme !== null)) + || (($mode = $this->getElement('theme_mode')) !== null + && ($mode->getValue()) !== $oldMode) ) { $this->getResponse()->setReloadCss(true); }