Mail: Drafts stay in "Drafts" folder when switching accounts

Created on 19 Jan 2020  路  5Comments  路  Source: nextcloud/mail

  1. Compose a new message
  2. Notice you are not on the right account
  3. Use the account switcher
  4. Send the email

Actual behavior

The last draft state of the message will stay in the "Drafts" folder of the first account.

Expected behavior

When you switch the account, the draft is moved from the first account to the account you switched to. Thus when you send the mail, no draft version is left.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

1. to develop bug feature parity drafts good first issue papercut

Most helpful comment

Hello, my name is Jennifer. I am a student in University of Michigan AnnArbor. I would like to know if this issue is still open and if I can try to fix this issue for a project in class.

All 5 comments

Oh yes, we need to send the draft account ID and draft folder ID to the server as well. Right now we send just one account and folder ID and assume it's both valid for the draft and the new draft or sent message. In this case this assumption is wrong.

Hello, my name is Jennifer. I am a student in University of Michigan AnnArbor. I would like to know if this issue is still open and if I can try to fix this issue for a project in class.

@OhanaM yes, the issue is waiting for someone to pick it up, so your contribution would be very welcome! :) Let us know if you need any help setting the development environment up, the documentation for that is at https://docs.nextcloud.com/server/latest/developer_manual/general/devenv.html

I looked over the code and here is my understanding of the issue: since saveDraft is an action that happens every time the user stop typing for some interval, when the user switches account, the old draft, since the program already called saveDraft earlier, will remain in the server, which causes the described behavior.
I was thinking since it is only sending one accountID to the server, can we link "check if draft exists, yes then delete existing draft" to the action of account switch? Will this behavior causes too much overhead and/or create a CVE

I was thinking since it is only sending one accountID to the server, can we link "check if draft exists, yes then delete existing draft" to the action of account switch?

Yep, something like that is needed. We send the old draft UID, but to the new account. So that won't match anything sensible. In most cases nothing will be deleted, in the worst case it deletes an unrelated draft from the newly selected account.

Will this behavior causes too much overhead and/or create a CVE

CVE?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristophWurst picture ChristophWurst  路  3Comments

g6094199 picture g6094199  路  3Comments

HLFH picture HLFH  路  3Comments

Quix0r picture Quix0r  路  5Comments

cheesewizz picture cheesewizz  路  5Comments