From 1e348e002e66768d80017d3d1a2b786097d6bbff Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 18 Dec 2020 08:02:07 +0100 Subject: [PATCH] Auto remove local drafts folder --- app/src/main/java/eu/faircode/email/Core.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index fa8d7c933e..4e4038362c 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1628,7 +1628,14 @@ class Core { } else { if (EntityFolder.DRAFTS.equals(folder.type)) drafts = true; - if (!folder.local) { + + if (folder.local) { + if (!EntityFolder.DRAFTS.equals(folder.type)) { + List ids = db.message().getMessageByFolder(folder.id); + if (ids == null || ids.size() == 0) + db.folder().deleteFolder(folder.id); + } + } else { local.put(folder.name, folder); if (folder.synchronize && folder.initialize != 0) sync_folders = true;