mirror of https://github.com/M66B/FairEmail.git
Fixed setting flags on move to/from drafts
This commit is contained in:
parent
b520845a0a
commit
0147728dc5
|
@ -781,7 +781,8 @@ class Core {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some providers do not support the COPY operation for drafts
|
// Some providers do not support the COPY operation for drafts
|
||||||
if (EntityFolder.DRAFTS.equals(folder.type) || EntityFolder.DRAFTS.equals(target.type)) {
|
boolean draft = (EntityFolder.DRAFTS.equals(folder.type) || EntityFolder.DRAFTS.equals(target.type));
|
||||||
|
if (draft) {
|
||||||
Log.i(folder.name + " move from " + folder.type + " to " + target.type);
|
Log.i(folder.name + " move from " + folder.type + " to " + target.type);
|
||||||
|
|
||||||
List<Message> icopies = new ArrayList<>();
|
List<Message> icopies = new ArrayList<>();
|
||||||
|
@ -803,21 +804,6 @@ class Core {
|
||||||
|
|
||||||
file.delete();
|
file.delete();
|
||||||
|
|
||||||
// Auto read
|
|
||||||
if (flags.contains(Flags.Flag.SEEN))
|
|
||||||
icopy.setFlag(Flags.Flag.SEEN, message.ui_seen);
|
|
||||||
|
|
||||||
// Auto unflag
|
|
||||||
if (flags.contains(Flags.Flag.FLAGGED))
|
|
||||||
icopy.setFlag(Flags.Flag.FLAGGED, message.ui_flagged);
|
|
||||||
|
|
||||||
// Answered fix
|
|
||||||
if (flags.contains(Flags.Flag.ANSWERED))
|
|
||||||
icopy.setFlag(Flags.Flag.ANSWERED, message.ui_answered);
|
|
||||||
|
|
||||||
// Set drafts flag
|
|
||||||
icopy.setFlag(Flags.Flag.DRAFT, EntityFolder.DRAFTS.equals(target.type));
|
|
||||||
|
|
||||||
icopies.add(icopy);
|
icopies.add(icopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,7 +839,7 @@ class Core {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch appended/copied when needed
|
// Fetch appended/copied when needed
|
||||||
if (!target.synchronize || !istore.hasCapability("IDLE"))
|
if (draft || !target.synchronize || !istore.hasCapability("IDLE"))
|
||||||
try {
|
try {
|
||||||
itarget.open(READ_WRITE);
|
itarget.open(READ_WRITE);
|
||||||
|
|
||||||
|
@ -862,9 +848,30 @@ class Core {
|
||||||
try {
|
try {
|
||||||
Long uid = findUid(itarget, message.msgid, false);
|
Long uid = findUid(itarget, message.msgid, false);
|
||||||
if (uid != null) {
|
if (uid != null) {
|
||||||
JSONArray fargs = new JSONArray();
|
if (draft) {
|
||||||
fargs.put(uid);
|
Message icopy = itarget.getMessageByUID(uid);
|
||||||
onFetch(context, fargs, target, itarget, state);
|
|
||||||
|
// Auto read
|
||||||
|
if (flags.contains(Flags.Flag.SEEN))
|
||||||
|
icopy.setFlag(Flags.Flag.SEEN, message.ui_seen);
|
||||||
|
|
||||||
|
// Auto unflag
|
||||||
|
if (flags.contains(Flags.Flag.FLAGGED))
|
||||||
|
icopy.setFlag(Flags.Flag.FLAGGED, message.ui_flagged);
|
||||||
|
|
||||||
|
// Answered fix
|
||||||
|
if (flags.contains(Flags.Flag.ANSWERED))
|
||||||
|
icopy.setFlag(Flags.Flag.ANSWERED, message.ui_answered);
|
||||||
|
|
||||||
|
// Set drafts flag
|
||||||
|
icopy.setFlag(Flags.Flag.DRAFT, EntityFolder.DRAFTS.equals(target.type));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!target.synchronize || !istore.hasCapability("IDLE")) {
|
||||||
|
JSONArray fargs = new JSONArray();
|
||||||
|
fargs.put(uid);
|
||||||
|
onFetch(context, fargs, target, itarget, state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.w(ex);
|
Log.w(ex);
|
||||||
|
|
Loading…
Reference in New Issue