Ensure outbox

pull/177/head
M66B 5 years ago
parent 83820ef382
commit 1d8d7e9c1c

@ -221,6 +221,16 @@ public class EntityFolder extends EntityOrder implements Serializable {
} }
} }
static EntityFolder getOutbox() {
EntityFolder outbox = new EntityFolder();
outbox.name = "OUTBOX";
outbox.type = EntityFolder.OUTBOX;
outbox.synchronize = false;
outbox.sync_days = 0;
outbox.keep_days = 0;
return outbox;
}
static String getNotificationChannelId(long id) { static String getNotificationChannelId(long id) {
return "notification.folder." + id; return "notification.folder." + id;
} }

@ -3905,8 +3905,11 @@ public class FragmentCompose extends FragmentBase {
EntityOperation.queue(context, draft, EntityOperation.DELETE); EntityOperation.queue(context, draft, EntityOperation.DELETE);
EntityFolder outbox = db.folder().getOutbox(); EntityFolder outbox = db.folder().getOutbox();
if (outbox == null) if (outbox == null) {
throw new IllegalArgumentException("Outbox missing"); Log.e("Outbox missing");
outbox = EntityFolder.getOutbox();
outbox.id = db.folder().insertFolder(outbox);
}
// Copy message to outbox // Copy message to outbox
draft.id = null; draft.id = null;

@ -320,12 +320,7 @@ public class FragmentSetup extends FragmentBase {
EntityFolder outbox = db.folder().getOutbox(); EntityFolder outbox = db.folder().getOutbox();
if (outbox == null) { if (outbox == null) {
outbox = new EntityFolder(); outbox = EntityFolder.getOutbox();
outbox.name = "OUTBOX";
outbox.type = EntityFolder.OUTBOX;
outbox.synchronize = false;
outbox.sync_days = 0;
outbox.keep_days = 0;
outbox.id = db.folder().insertFolder(outbox); outbox.id = db.folder().insertFolder(outbox);
} }

Loading…
Cancel
Save