From 0de92a5a01767dfa5e72ea0b702c6f18e583bbdb Mon Sep 17 00:00:00 2001 From: Ximi1970 Date: Thu, 21 May 2020 12:12:10 +0200 Subject: [PATCH] Fix clean startup --- webext/js/defaults.js | 10 +++++++++- webext/options.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/webext/js/defaults.js b/webext/js/defaults.js index ce78a71..a047f6d 100644 --- a/webext/js/defaults.js +++ b/webext/js/defaults.js @@ -98,7 +98,11 @@ function checkFilters(filters) { const inbox = account.folders.filter((folder) => folder.type == "inbox"); if (inbox.length > 0) { - let folder = { ...inbox[0], accountName: account.name }; + let folder = { + ...inbox[0], + accountName: account.name, + path: "/" + inbox[0].name, + }; delete folder.type; delete folder.subFolders; @@ -254,8 +258,12 @@ async function getFilters() { function getFiltersCb(result) { const filters = result.filters || undefined; + console.debug("Stored fiilters: " + JSON.stringify(filters)); + const newFilters = checkFilters(filters); + console.debug("Checked fiilters: " + JSON.stringify(newFilters)); + return newFilters; } diff --git a/webext/options.js b/webext/options.js index 86498fc..5806530 100644 --- a/webext/options.js +++ b/webext/options.js @@ -444,9 +444,17 @@ SysTrayX.RestoreOptions = { ); if (inbox.length > 0) { + let folder = { + ...inbox[0], + accountName: account.name, + path: "/" + inbox[0].name, + }; + delete folder.type; + delete folder.subFolders; + filters.push({ unread: true, - folder: inbox[0], + folder: folder, }); } });