Delete orphan drafts

This commit is contained in:
M66B 2021-04-23 21:33:03 +02:00
parent d25b90b8eb
commit 1f4a09b4df
1 changed files with 9 additions and 4 deletions

View File

@ -644,11 +644,16 @@ class Core {
if (TextUtils.isEmpty(message.msgid))
throw new IllegalArgumentException("Message without msgid for " + op.name);
Long uid = findUid(context, ifolder, message.msgid, false);
if (uid == null)
throw new IllegalArgumentException("Message not found for " + op.name + " folder=" + folder.name);
DB db = DB.getInstance(context);
Long uid = findUid(context, ifolder, message.msgid, false);
if (uid == null) {
if (EntityFolder.DRAFTS.equals(folder.type) &&
EntityOperation.MOVE.equals(op.name))
db.message().deleteMessage(message.id);
throw new IllegalArgumentException("Message not found for " + op.name + " folder=" + folder.name);
}
db.message().setMessageUid(message.id, message.uid);
message.uid = uid;
}