Added solution for draft orphans

This commit is contained in:
M66B
2023-04-17 09:21:02 +02:00
parent 79db67e336
commit 95079b7b70
2 changed files with 20 additions and 0 deletions

View File

@@ -795,6 +795,18 @@ public class EntityOperation {
if (foreground && folder.sync_state == null) // Show spinner
db.folder().setFolderSyncState(fid, "requested");
if (force && foreground && EntityFolder.DRAFTS.equals(folder.type)) {
EntityAccount account = db.account().getAccount(folder.account);
if (account.protocol == EntityAccount.TYPE_IMAP) {
List<EntityMessage> orphans = db.message().getDraftOrphans(folder.id);
if (orphans != null) {
EntityLog.log(context, "Draft orphans=" + orphans.size());
for (EntityMessage orphan : orphans)
EntityOperation.queue(context, orphan, EntityOperation.ADD);
}
}
}
if (foreground && EntityFolder.SENT.equals(folder.type)) {
EntityAccount account = db.account().getAccount(folder.account);
if (account.protocol == EntityAccount.TYPE_IMAP) {