Fix changing theme color and properly sync settings.
This commit is contained in:
parent
b5f2e7f0cc
commit
ee92de0ff7
@ -481,7 +481,7 @@ export default {
|
|||||||
value = event.target.value;
|
value = event.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.options.updateSetting(name, value);
|
this.options.updateSetting(name, value, true);
|
||||||
},
|
},
|
||||||
changePassword() {
|
changePassword() {
|
||||||
const allFields = new FormData(this.$refs.settingsForm);
|
const allFields = new FormData(this.$refs.settingsForm);
|
||||||
|
@ -84,20 +84,18 @@ function updateDesktopNotificationStatus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applySetting(name, value) {
|
function applySetting(name, value) {
|
||||||
if (name === "syncSettings" && value) {
|
if (name === "theme") {
|
||||||
$syncWarningOverride.hide();
|
|
||||||
$forceSyncButton.hide();
|
|
||||||
} else if (name === "theme") {
|
|
||||||
const themeUrl = `themes/${value}.css`;
|
const themeUrl = `themes/${value}.css`;
|
||||||
|
|
||||||
if ($theme.attr("href") !== themeUrl) {
|
if ($theme.attr("href") !== themeUrl) {
|
||||||
$theme.attr("href", themeUrl);
|
$theme.attr("href", themeUrl);
|
||||||
|
const newTheme = vueApp.serverConfiguration.themes.filter(
|
||||||
const newTheme = $settings.find("#theme-select option[value='" + value + "']");
|
(theme) => theme.name === value
|
||||||
|
)[0];
|
||||||
let themeColor = defaultThemeColor;
|
let themeColor = defaultThemeColor;
|
||||||
|
|
||||||
if (newTheme.length > 0 && newTheme[0].dataset.themeColor) {
|
if (newTheme.themeColor) {
|
||||||
themeColor = newTheme[0].dataset.themeColor;
|
themeColor = newTheme.themeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector('meta[name="theme-color"]').content = themeColor;
|
document.querySelector('meta[name="theme-color"]').content = themeColor;
|
||||||
@ -117,7 +115,7 @@ function settingSetEmit(name, value) {
|
|||||||
socket.emit("setting:set", {name, value});
|
socket.emit("setting:set", {name, value});
|
||||||
}
|
}
|
||||||
|
|
||||||
// When sync is `true` the setting will also be send to the backend for syncing.
|
// When sync is `true` the setting will also be sent to the backend for syncing.
|
||||||
function updateSetting(name, value, sync) {
|
function updateSetting(name, value, sync) {
|
||||||
settings[name] = value;
|
settings[name] = value;
|
||||||
storage.set("settings", JSON.stringify(settings));
|
storage.set("settings", JSON.stringify(settings));
|
||||||
|
Loading…
Reference in New Issue
Block a user