mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 16:43:26 +02:00
Correct multiple inboxes
This commit is contained in:
@@ -2992,9 +2992,16 @@ class Core {
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
if (EntityFolder.INBOX.equals(type)) // Case insensitive
|
||||
folder = db.folder().getFolderByType(account.id, type);
|
||||
else
|
||||
if (EntityFolder.INBOX.equals(type)) { // Case insensitive
|
||||
List<EntityFolder> inboxes = db.folder().getFoldersByType(account.id, type);
|
||||
if (inboxes == null || inboxes.isEmpty())
|
||||
folder = null;
|
||||
else {
|
||||
folder = inboxes.get(0);
|
||||
for (int i = 1; i < inboxes.size(); i++)
|
||||
db.folder().deleteFolder(inboxes.get(i).id);
|
||||
}
|
||||
} else
|
||||
folder = db.folder().getFolderByName(account.id, fullName);
|
||||
if (folder == null) {
|
||||
EntityFolder parent = null;
|
||||
|
||||
@@ -236,6 +236,11 @@ public interface DaoFolder {
|
||||
" WHERE account = :account AND type = :type")
|
||||
EntityFolder getFolderByType(long account, String type);
|
||||
|
||||
@Query("SELECT folder.* FROM folder" +
|
||||
" WHERE account = :account AND type = :type" +
|
||||
" ORDER BY folder.id")
|
||||
List<EntityFolder> getFoldersByType(long account, String type);
|
||||
|
||||
@Query("SELECT folder.* FROM folder" +
|
||||
" JOIN account ON account.id = folder.account" +
|
||||
" WHERE account.synchronize" +
|
||||
|
||||
Reference in New Issue
Block a user