Rework Draft Handling - Backend Part
- [ ] API Endpoints: PUT, POST to move local message to IMAP, DELETE to delete local and IMAP message (if any).
- [ ] Provide sync endpoint that syncs local to IMAP drafts box.
- The other way around - syncing from IMAP to local - should be handled carefully and should not overwrite the local message if it is newer. (Question: is there a timestamp on IMAP draft to compare?)
- [ ] Provide sync reset endpoint that resets the UID and deletes the associated IMAP draft (to be recreated later as IMAP messages are immutable)
- this only works if another client doesn't do the same. But then there is nothing we can do and the draft will be duplicated.
- [ ] Migration to add UID field to the local_messages table when it has been synced
- [ ] Provide a background job that syncs local drafts to IMAP in case the user closes the window instead of the modal and doesn't come back.
- [ ] Add attachments support
- [ ] Handle sending by providing an endpoint to make a draft an outbox message which then also deletes the IMAP draft (if any). let the outbox logic do the rest
Note: the Outbox Backend already handles drafts via an OutboxCreatedEvent that triggers the DeleteDraftListerner. Adjust this class to delete local and IMAP drafts.
Note: We do need a GET for the contents of a draft (unless we load all messages with their content?) something for the fontenders to tell me :)
Note: We do need a GET for the contents of a draft (unless we load all messages with their content?) something for the fontenders to tell me :)
https://github.com/nextcloud/mail/issues/4768#issuecomment-1224352762. MessageService.js::fetchMessage.
Leftovers
- [x] T6
UC3 doesn't work apparently. Local drafts stay local draft forever, the background job does not move idle items to IMAP.