diff --git a/src/Ui/media/ZeroSiteTheme.coffee b/src/Ui/media/ZeroSiteTheme.coffee index 47144051..79adb671 100644 --- a/src/Ui/media/ZeroSiteTheme.coffee +++ b/src/Ui/media/ZeroSiteTheme.coffee @@ -9,10 +9,10 @@ changeColorScheme = (theme) -> zeroframe.cmd "userGetGlobalSettings", [], (user_settings) -> if user_settings.theme != theme user_settings.theme = theme - zeroframe.cmd "userSetGlobalSettings", [user_settings] - - location.reload() - + zeroframe.cmd "userSetGlobalSettings", [user_settings], (status) -> + if status == "ok" + location.reload() + return return return @@ -21,7 +21,12 @@ displayNotification = ({matches, media}) -> if !matches return - zeroframe.cmd "wrapperNotification", ["info", "Your system's theme has been changed.
Please reload site to use it."] + zeroframe.cmd "siteInfo", [], (site_info) -> + if "ADMIN" in site_info.settings.permissions + zeroframe.cmd "wrapperNotification", ["info", "Your system's theme has been changed.
Please reload site to use it."] + else + zeroframe.cmd "wrapperNotification", ["info", "Your system's theme has been changed.
Please open ZeroHello to use it."] + return return diff --git a/src/Ui/media/all.js b/src/Ui/media/all.js index fc7d6fda..86c61b51 100644 --- a/src/Ui/media/all.js +++ b/src/Ui/media/all.js @@ -1981,7 +1981,6 @@ $.extend( $.easing, }).call(this); - /* ---- src/Ui/media/WrapperZeroFrame.coffee ---- */ @@ -2037,7 +2036,8 @@ $.extend( $.easing, (function() { - var DARK, LIGHT, changeColorScheme, detectColorScheme, displayNotification, mqDark, mqLight; + var DARK, LIGHT, changeColorScheme, detectColorScheme, displayNotification, mqDark, mqLight, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; DARK = "(prefers-color-scheme: dark)"; @@ -2051,8 +2051,11 @@ $.extend( $.easing, zeroframe.cmd("userGetGlobalSettings", [], function(user_settings) { if (user_settings.theme !== theme) { user_settings.theme = theme; - zeroframe.cmd("userSetGlobalSettings", [user_settings]); - location.reload(); + zeroframe.cmd("userSetGlobalSettings", [user_settings], function(status) { + if (status === "ok") { + location.reload(); + } + }); } }); }; @@ -2063,7 +2066,13 @@ $.extend( $.easing, if (!matches) { return; } - zeroframe.cmd("wrapperNotification", ["info", "Your system's theme has been changed.
Please reload site to use it."]); + zeroframe.cmd("siteInfo", [], function(site_info) { + if (indexOf.call(site_info.settings.permissions, "ADMIN") >= 0) { + zeroframe.cmd("wrapperNotification", ["info", "Your system's theme has been changed.
Please reload site to use it."]); + } else { + zeroframe.cmd("wrapperNotification", ["info", "Your system's theme has been changed.
Please open ZeroHello to use it."]); + } + }); }; detectColorScheme = function() { @@ -2082,4 +2091,4 @@ $.extend( $.easing, } }); -}).call(this); \ No newline at end of file +}).call(this);