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

View File

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