From cf63f9d0256fc4e8952ab8e427e6fd9b3847187d Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Fri, 2 Sep 2022 00:46:07 +0300 Subject: [PATCH] [themes] fix bug 58801 --- apps/common/main/lib/controller/Themes.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/common/main/lib/controller/Themes.js b/apps/common/main/lib/controller/Themes.js index 62efa4b51..729903d03 100644 --- a/apps/common/main/lib/controller/Themes.js +++ b/apps/common/main/lib/controller/Themes.js @@ -427,7 +427,26 @@ define([ var id = get_ui_theme_name(obj), refresh_only = arguments[1]; + if ( !refresh_only && is_theme_type_system(this.currentThemeId()) ) { + // TODO: need refactoring. for bug 58801 + if ( get_system_default_theme().id == id ) { + Common.localStorage.setBool('ui-theme-use-system', false); + Common.localStorage.setItem('ui-theme-id', ''); + Common.localStorage.setItem('ui-theme-id', id); + Common.NotificationCenter.trigger('uitheme:changed', id); + return; + } + } + if ( is_theme_type_system(id) ) { + if ( get_system_default_theme().id == this.currentThemeId() ) { + Common.localStorage.setBool('ui-theme-use-system', true); + Common.localStorage.setItem('ui-theme-id', ''); + Common.localStorage.setItem('ui-theme-id', id); + Common.NotificationCenter.trigger('uitheme:changed', id); + return; + } + Common.localStorage.setBool('ui-theme-use-system', true); id = get_system_default_theme().id; } else {