mirror of https://github.com/M66B/FairEmail.git
Check cross account move conditions
This commit is contained in:
parent
aaafa4275a
commit
abfa20cb84
|
@ -2084,6 +2084,18 @@ public class FragmentMessages extends FragmentBase {
|
||||||
EntityMessage message = db.message().getMessage(target.id);
|
EntityMessage message = db.message().getMessage(target.id);
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
Log.i("Move id=" + target.id + " target=" + target.folder.name);
|
Log.i("Move id=" + target.id + " target=" + target.folder.name);
|
||||||
|
|
||||||
|
// Cross account move: check if message downloaded
|
||||||
|
if (!target.folder.account.equals(message.account)) {
|
||||||
|
if (!message.content)
|
||||||
|
throw new IllegalArgumentException(getString(R.string.title_no_accross));
|
||||||
|
|
||||||
|
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||||
|
for (EntityAttachment attachment : attachments)
|
||||||
|
if (!attachment.available)
|
||||||
|
throw new IllegalArgumentException(getString(R.string.title_no_accross));
|
||||||
|
}
|
||||||
|
|
||||||
EntityOperation.queue(context, db, message, EntityOperation.MOVE, target.folder.id);
|
EntityOperation.queue(context, db, message, EntityOperation.MOVE, target.folder.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2097,7 +2109,10 @@ public class FragmentMessages extends FragmentBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
if (ex instanceof IllegalArgumentException)
|
||||||
|
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
|
||||||
|
else
|
||||||
|
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||||
}
|
}
|
||||||
}.execute(FragmentMessages.this, args, "messages:move");
|
}.execute(FragmentMessages.this, args, "messages:move");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1675,6 +1675,14 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doAdd(EntityFolder folder, Session isession, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException, IOException {
|
private void doAdd(EntityFolder folder, Session isession, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException, IOException {
|
||||||
|
if (!message.content)
|
||||||
|
throw new IllegalArgumentException("Message body missing");
|
||||||
|
|
||||||
|
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||||
|
for (EntityAttachment attachment : attachments)
|
||||||
|
if (!attachment.available)
|
||||||
|
throw new IllegalArgumentException("Attachment missing");
|
||||||
|
|
||||||
// Append message
|
// Append message
|
||||||
MimeMessage imessage = MessageHelper.from(this, message, isession);
|
MimeMessage imessage = MessageHelper.from(this, message, isession);
|
||||||
|
|
||||||
|
|
|
@ -306,6 +306,7 @@
|
||||||
<string name="title_no_stream">An outdated app sent a file path instead of a file stream</string>
|
<string name="title_no_stream">An outdated app sent a file path instead of a file stream</string>
|
||||||
<string name="title_no_contacts">Contact picker not available</string>
|
<string name="title_no_contacts">Contact picker not available</string>
|
||||||
<string name="title_no_internet">No internet connection</string>
|
<string name="title_no_internet">No internet connection</string>
|
||||||
|
<string name="title_no_accross">Moving across accounts requires all message content to be downloaded</string>
|
||||||
<string name="title_raw_saved">Raw message saved</string>
|
<string name="title_raw_saved">Raw message saved</string>
|
||||||
<string name="title_attachment_saved">Attachment saved</string>
|
<string name="title_attachment_saved">Attachment saved</string>
|
||||||
<string name="title_attachments_saved">Attachments saved</string>
|
<string name="title_attachments_saved">Attachments saved</string>
|
||||||
|
|
Loading…
Reference in New Issue