From ca401f27ea2366389eae449e579ae429d48354ee Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 11 May 2022 08:30:18 +0200 Subject: [PATCH] Auto map new folders --- app/src/main/java/eu/faircode/email/Core.java | 8 +++++++- 1 file changed, 7 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 e4212dc74b..c7f8850f9e 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2529,12 +2529,18 @@ class Core { if (sep > 0) parent = db.folder().getFolderByName(account.id, fullName.substring(0, sep)); + if (!EntityFolder.USER.equals(type) && !EntityFolder.SYSTEM.equals(type)) { + EntityFolder has = db.folder().getFolderByType(account.id, type); + if (has != null) + type = EntityFolder.USER; + } + folder = new EntityFolder(); folder.account = account.id; folder.namespace = ifolder.first.getFullName(); folder.separator = separator; folder.name = fullName; - folder.type = (EntityFolder.SYSTEM.equals(type) ? type : EntityFolder.USER); + folder.type = type; folder.subscribed = subscribed; folder.selectable = selectable; folder.inferiors = inferiors;