Switch client to default theme when it is using a theme that has been removed

This commit is contained in:
Jérémie Astori 2018-04-02 00:25:45 -04:00
parent 4e5c924e5c
commit 62fb5524ae
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8
3 changed files with 8 additions and 1 deletions

View File

@ -281,7 +281,7 @@ function initialize() {
} }
$settings.on("change", "input, select, textarea", function(e) { $settings.on("change", "input, select, textarea", function(e) {
// We only want to trigger on human triggerd changes. // We only want to trigger on human triggered changes.
if (e.originalEvent) { if (e.originalEvent) {
const $self = $(this); const $self = $(this);
const type = $self.prop("type"); const type = $self.prop("type");

View File

@ -25,6 +25,12 @@ socket.on("configuration", function(data) {
options.initialize(); options.initialize();
webpush.initialize(); webpush.initialize();
// If localStorage contains a theme that does not exist on this server, switch
// back to its default theme.
if (!data.themes.map((t) => t.name).includes(options.settings.theme)) {
options.processSetting("theme", data.defaultTheme, true);
}
const forms = $("#connect form, #change-password form"); const forms = $("#connect form, #change-password form");
forms.on("submit", function() { forms.on("submit", function() {

View File

@ -555,6 +555,7 @@ function getClientConfiguration() {
config.version = pkg.version; config.version = pkg.version;
config.gitCommit = Helper.getGitCommit(); config.gitCommit = Helper.getGitCommit();
config.themes = themes.getAll(); config.themes = themes.getAll();
config.defaultTheme = Helper.config.theme;
if (config.displayNetwork) { if (config.displayNetwork) {
config.defaults = _.clone(Helper.config.defaults); config.defaults = _.clone(Helper.config.defaults);