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
load profiles when attaching a file, so smtp drafts are correctly saved #508
load profiles when attaching a file, so smtp drafts are correctly saved #508
Conversation
…ed into a linked imap profile drafts folder; additionally send local attachments saved to first draft as part of imap draft sending procedure - otherwise, attachments stay on the server and are never sent out
Hi @kroky, thanks for the analysis and the hotfix, I'm already working with your proposal and I'll come back here with more information. I'm prioritizing this fix before continuing on to other tasks. Thanks again. |
Thanks to both of you for looking into this. Attachments repeatedly fail for me I think so I might be able to consistently reproduce + test a fix. Not loading profiles on calls is likely a big part of the problem so nice catch there @kroky. If it helps recall that we should be ONLY supporting IMAP drafts at this point, I want to remove/obsolete the original draft functionality. Also when saving a draft with an attachment, the attachment should be part of the saved draft itself in IMAP, and when the draft is loaded fetched from there, not stored locally like when you originally attach one for a message you are composing (hope that makes sense!) |
Ah, that makes sense! I think this latest fix now saves the attachments as part of the imap draft but more code is needed to load them fine in the compose form (parsing of email parts needs to be done and figuring out what is an attachment and what not). I wasn't aware that obsolete draft functionality will be removed. |
@kroky and @henrique-borba is this ready to merge? |
@jasonmunro I have no new input here, maybe @henrique-borba will push his changes when they are ready. If you merge this PR now, we will have a partial fix for the attachment issue which is still better than no fix but still not 100% ready. |
@kroky @jasonmunro The implementation I made (#518) works the way you guys discussed. Basically, after removing the old draft method I updated the save_uploaded_file method calls to use the UID of the IMAP drafts and update the uploaded files keys with the new UID every time a draft is edited. The moment a previously saved draft is opened, the attachments are downloaded and added again to the "uploaded_files" array, this way the compose page can correctly manage the attachments. As this PR (#508) assumes that the legacy drafts are still in use, I believe it is no longer necessary. |
Thanks @henrique-borba ! Yes, PR is partially outdated now but I think you still need the bits about profiles when auto-saving draft with an attachment via ajax. save_imap_draft method uses |
@kroky you are correct, how should we proceed? I think @jasonmunro can accept yours first and I merge mine after, any conflicts if they happen I can resolve. Thanks again =D |
@henrique-borba I don't mind you copy those couple of lines to your PR and have @jasonmunro merge only one PR. He can close this one in favor of yours. Thanks! |
... into a linked imap profile drafts folder; additionally send local attachments saved to first draft as part of imap draft sending procedure - otherwise, attachments stay on the server and are never sent out
@henrique-borba I think saving imap drafts when smtp/imap profile is setup is your work, can you check out these fixes? The main problem I was hunting is missing files in the sent email after attaching them to a message. However, I found another bug as well. In short:
a) delete local attachments when imap draft is saved as those are saved as part of the imap message
b) show attachments to the imap draft in the compose form when editing an imap draft
c) send those attachments even if they are not locally uploaded when submitting the compose form
If you have a different/easier to implement idea, I am also fine but I think this imap draft feature needs some updates in order to work fine with attachments.