Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to fix draft versions, missing attachments when sending email #453

Merged
merged 1 commit into from Feb 15, 2021

Conversation

kroky
Copy link
Member

@kroky kroky commented Feb 15, 2021

This attempts to fix #421 and #436. The problem I see is with draft version numbers and the fact that new attachments are tied to a draft that is not actually saved in the session, so interactions with cypht in another browser tab could eventually destroy the attachment.

The changes implemented here are making a slight change in behavior which I think is logical. Here are they:

  1. Attaching a file from the compose page to a draft that has not yet been saved automatically saves the draft. This should allow working on other reply/forward/compose pages in the same session in another tab without loosing or interfering with the file you just uploaded.
  2. Fixed numbering issue when deleting drafts - if you had drafts with IDs 0, 1 and 2, deleted 1 and added another one, it would have added that as 2 replacing the previous version 2 because of using the count() method on the drafts array. Instead, we are now using the max key and incrementing that with 1.
  3. Forwarding messages automatically creates an attachment but also automatically creates a draft. It is also automatically saved as soon as the forward compose form is loaded, so we have all the details in the draft itself (rather than just the attached email). This will fix Attachment mismatch: forwarded email gets attachment from a previous draft #436 by creating new drafts for each forwarding operation you do.

A side-effect of this change is the auto-saving of drafts happening on 30 seconds interval by default. We now save all draft contents even when no subject is entered (so we can keep the attachments in the drafts without subjects). I think this is behavior similar to other mail clients that won't let you quit an unsaved/unsent compose page even if there is no subject entered. We can improve here by ignoring saving of drafts that are completely empty, so opening the compose page but not doing anything should not actually save as draft.

Jason, let me know your thoughts and what else to improve here!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.104% when pulling 04759c1 on kroky:bugfix/drafts into 2a9060a on jasonmunro:master.

@jasonmunro
Copy link
Member

@kroky awesome this sounds really great! I'm going to merge and give it a go. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants