mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Added solution for draft orphans
This commit is contained in:
parent
79db67e336
commit
95079b7b70
2 changed files with 20 additions and 0 deletions
|
@ -984,6 +984,14 @@ public interface DaoMessage {
|
|||
)
|
||||
int deleteOrphans(long folder, long now);
|
||||
|
||||
@Query("SELECT * FROM message" +
|
||||
" WHERE folder = :folder" +
|
||||
" AND uid IS NULL" +
|
||||
" AND NOT EXISTS" +
|
||||
" (SELECT * FROM operation" +
|
||||
" WHERE operation.message = message.id)")
|
||||
List<EntityMessage> getDraftOrphans(long folder);
|
||||
|
||||
@Query("SELECT * FROM message" +
|
||||
" WHERE folder = :folder" +
|
||||
" AND uid IS NULL" +
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue