Correct multiple inboxes

master
M66B 3 months ago
parent e0f05c8205
commit 63c30a8bd0

@ -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" +

Loading…
Cancel
Save