Fixed moving Gmail drafts

This commit is contained in:
M66B 2022-06-25 07:13:31 +02:00
parent abeae50ccc
commit d3d98339d9
2 changed files with 8 additions and 3 deletions

View File

@ -1417,8 +1417,7 @@ class Core {
// Some providers do not support the COPY operation for drafts
boolean draft = (EntityFolder.DRAFTS.equals(folder.type) || EntityFolder.DRAFTS.equals(target.type));
boolean duplicate = (copy && !account.isGmail()) ||
(draft && EntityFolder.ARCHIVE.equals(target.type) && account.isGmail());
boolean duplicate = (copy && !account.isGmail()) || (draft && account.isGmail());
if (draft || duplicate) {
Log.i(folder.name + " " + (duplicate ? "copy" : "move") +
" from " + folder.type + " to " + target.type);

View File

@ -257,6 +257,7 @@ public class EntityOperation {
if (message.ui_found)
db.message().setMessageFound(message.id, false);
boolean premove = true;
if (source.account.equals(target.account)) {
EntityAccount account = db.account().getAccount(message.account);
if ((account != null && !account.isGmail()) ||
@ -269,6 +270,10 @@ public class EntityOperation {
EntityFolder.ARCHIVE.equals(source.type) &&
!(EntityFolder.TRASH.equals(target.type) || EntityFolder.JUNK.equals(target.type)))
name = COPY;
if (account != null && account.isGmail() &&
(EntityFolder.DRAFTS.equals(source.type) || EntityFolder.DRAFTS.equals(target.type)))
premove = false;
}
if (message.ui_snoozed != null &&
@ -296,7 +301,8 @@ public class EntityOperation {
// Create copy without uid in target folder
// Message with same msgid can be in archive
if (message.uid != null &&
if (premove &&
message.uid != null &&
!TextUtils.isEmpty(message.msgid) &&
db.message().countMessageByMsgId(target.id, message.msgid) == 0) {
File msource = message.getFile(context);