mirror of https://github.com/M66B/FairEmail.git
No more orphans
This commit is contained in:
parent
ff0e14bf60
commit
d25bbcb5d9
|
@ -2482,20 +2482,9 @@ class Core {
|
|||
}
|
||||
}
|
||||
|
||||
// Add local sent messages to remote sent folder
|
||||
if (EntityFolder.SENT.equals(folder.type)) {
|
||||
List<EntityMessage> orphans = db.message().getOrphans(folder.id);
|
||||
Log.i(folder.name + " sent orphans=" + orphans.size());
|
||||
for (EntityMessage orphan : orphans) {
|
||||
Log.i(folder.name + " adding orphan id=" + orphan.id);
|
||||
if (orphan.content && !orphan.ui_hide)
|
||||
EntityOperation.queue(context, orphan, EntityOperation.ADD);
|
||||
}
|
||||
} else {
|
||||
// Delete not synchronized messages without uid
|
||||
if (!EntityFolder.DRAFTS.equals(folder.type))
|
||||
db.message().deleteOrphans(folder.id);
|
||||
}
|
||||
// Delete not synchronized messages without uid
|
||||
if (!EntityFolder.isOutgoing(folder.type))
|
||||
db.message().deleteOrphans(folder.id);
|
||||
|
||||
int count = MessageHelper.getMessageCount(ifolder);
|
||||
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
||||
|
|
|
@ -546,15 +546,6 @@ public interface DaoMessage {
|
|||
" WHERE folder = :folder")
|
||||
List<TupleUidl> getUidls(long folder);
|
||||
|
||||
@Query("SELECT * FROM message" +
|
||||
" WHERE folder = :folder" +
|
||||
" AND uid IS NULL" +
|
||||
" AND NOT EXISTS" +
|
||||
" (SELECT * FROM operation" +
|
||||
" WHERE operation.message = message.id" +
|
||||
" AND operation.name = '" + EntityOperation.ADD + "')")
|
||||
List<EntityMessage> getOrphans(long folder);
|
||||
|
||||
@Query("SELECT * FROM message" +
|
||||
" WHERE (:folder IS NULL OR folder = :folder)" +
|
||||
" AND NOT ui_snoozed IS NULL")
|
||||
|
|
Loading…
Reference in New Issue