Saving draft message opened from Drafts *subfolder* unexpectedly creates a new copy of the draft in main Drafts folder, resulting in multiple versions and gross error-prone ux-confusion
Categories
(Thunderbird :: Mail Window Front End, defect)
Tracking
(thunderbird_esr115 fixed, thunderbird119 fixed)
People
(Reporter: jamie, Assigned: gds)
References
(Blocks 1 open bug)
Details
(Whiteboard: [TM 115.4.1])
Attachments
(2 files, 1 obsolete file)
275.23 KB,
text/plain
|
Details | |
48 bytes,
text/x-phabricator-request
|
wsmwk
:
approval-comm-beta+
wsmwk
:
approval-comm-esr115+
|
Details | Review |
Comment 1•20 years ago
|
||
Comment 2•20 years ago
|
||
Comment 3•20 years ago
|
||
Updated•18 years ago
|
Reporter | ||
Comment 6•17 years ago
|
||
Comment 7•17 years ago
|
||
Comment 9•17 years ago
|
||
Comment 10•17 years ago
|
||
Comment 11•17 years ago
|
||
Comment 12•17 years ago
|
||
Comment 14•17 years ago
|
||
Comment 15•17 years ago
|
||
Comment 16•17 years ago
|
||
Comment 17•17 years ago
|
||
Comment 18•17 years ago
|
||
Reporter | ||
Comment 19•17 years ago
|
||
Comment 20•17 years ago
|
||
Comment 21•17 years ago
|
||
Comment 22•16 years ago
|
||
Comment 23•16 years ago
|
||
Comment 24•16 years ago
|
||
Comment 25•14 years ago
|
||
Comment 26•14 years ago
|
||
Comment 27•13 years ago
|
||
Comment 28•13 years ago
|
||
Comment 29•13 years ago
|
||
Comment 30•13 years ago
|
||
Comment 31•13 years ago
|
||
Comment 32•10 years ago
|
||
Comment 33•10 years ago
|
||
Updated•6 years ago
|
Comment 34•6 years ago
|
||
not dataloss - it's just in the wrong place
Updated•3 years ago
|
Comment 36•3 years ago
|
||
I have a lot of drafts for many ongoing projects. To be forced to organize them in a single folder (using subject or tags) is very inconvenient, to say the least. I'd really appreciate to have the option to organize drafts as drafts in subfolders.
The current UI (102.6.0) is indeed misleading, too: A right click on a message in a subfolder of Drafts says "Edit Draft" but actually creates a new message (as if clicked "Edit as new") in drafts top folder - which is more a "template" functionality.
Comment 37•2 years ago
|
||
Absolutely astounding that this isn't fixed after 19 years.
This is ABSOLUTELY a data-corruption issue. If you work on drafts over time and use subfolders then this is inevitably at some point going to lead you to making changes to a draft and then later going back and making changes to a different draft thinking it's the most recent copy, with the end result that what's in the draft is not what you expect. And it's a data-loss issue in that if you do all that and then end up sending a draft without all of your changes in it those missing changes are effectively lost.
As for the people who made snarky comments above about it being "unusual" to keep drafts in subfolders, (a) storing scheduled drafts is the most common request I get for Send Later, and (b) many Send Later users have made it clear that they have literally hundreds of drafts at any given time, making it entirely understandable why they might want to organize them in subfolders. I think the TB devs here need to spend a bit of time trying to imagine how users of TB might use it differently than they do.
If TB is going to treat subfolders of Drafts folders as Drafts folders themselves, then it needs to handle this properly. To be clear, fixing this is the right answer, NOT preventing drafts folders from having subfolders that are also drafts folders. This is clearly a feature that users want and need, and it should be fully and properly supported, not gotten rid of.
Comment 38•2 years ago
|
||
Sorry, to clarify a typo in my last comment: storing scheduled drafts in a different folder is the most common request I get for Send Later.
Comment 39•2 years ago
|
||
The question I would pose, which I'm not sure has been raised so far, is whether there is an RFC (spec) which requires, supports or allows for what is requested in this bug.
Comment 40•2 years ago
|
||
I don't understand what you're asking here.
Do you mean, like an Internet RFC from the IETF? I can't imagine that's what you mean, because how Thunderbird chooses to manage folders has nothing to do with Internet RFC's, but that's the meaning I can most readily map to the acronym.
If you're asking whether this is somehow linked in to what is permitted by the IMAP protocol, then (a) I would mention that Thunderbird does note just support IMAP, (b) even if IMAP needed to treat this specially it could still be permitted in Local Folders, (c) in any case, RFC 6154 does not preclude multiple folders from being marked as drafts folders, and (d) the IMAP protocol standards do not actually require any particular folder to be designated as a drafts folder or even require clients to use the folders designed a la RFC 6154 for that purpose; it's all convention and the client is allowed to do whatever it wants.
Finally, I would like to reiterate that there was clearly already the intent for Thunderbird to treat subfolders of drafts folders as drafts folders, since it "half works" in the sense that when you create a subfolder of your designed drafts folder the messages in it are treated like drafts.
TLDR there is no standards-based objection to Thunderbird supporting this. It would be useful to people. There was already at least half of an effort to make it work. I can't imagine why we would throw that away rather than finishing it.
Comment 41•2 years ago
|
||
Finally, I would like to reiterate that there was clearly already the intent for Thunderbird to treat subfolders of drafts folders as drafts folders, since it "half works" in the sense that when you create a subfolder of your designed drafts folder the messages in it are treated like drafts.
Unless we find code comments that indicate intention to support this, or a bug that intentionaly started to impliment this, I don't see how it can be claimed that anything seen as partially working is happening by intention.
Comment 42•2 years ago
|
||
The implementation of nsMsgDBFolder::IsSpecialFolder in mailnews/base/src/nsMsgDBFolder.cpp takes a boolean argument indicating whether a folder's ancestors should be checked to determine whether it is the specified kind of special folder. The code in mail/base/content/msgHdrView.js that calls it to determine whether to allow a user to edit a message as a draft in a particular folder, in particular, the function setDraftEditMessage(), sets that boolean argument to true. Someone made an intentional choice for it to behave this way.
The revision history in hg only goes back to 2008 and it was like this in the very first revision, so I know of no way to find the commit in which this decision was originally made so we can look at what the commit message said.
In any case, I am struggling to understand why the conversation we are having is "Was this the original intention many years ago" instead of "Would this be useful functionality that would benefit users".
Comment 43•2 years ago
|
||
We've looked at the issue. The summary "Saving draft message opened from Drafts subfolder unexpectedly creates a new copy of the draft in main Drafts folder, resulting in multiple versions" is not strictly true. If you create a subfolder which also carries the drafts flag, you can use this add-on to set it, then the original draft is removed from the subfolder and the new draft is stored in the top drafts folder. If the subfolder doesn't have the drafts flag, deletion is prevented here:
https://searchfox.org/comm-central/rev/6187e08a6cba6e0534369e7a2aea025be66331c6/mailnews/compose/src/nsMsgCompose.cpp#3300,3345
The trouble is that new drafts/template are created in the send pipeline. The target folder for save is retrieved here from the account preferences:
https://searchfox.org/comm-central/rev/6187e08a6cba6e0534369e7a2aea025be66331c6/mailnews/compose/src/MessageSend.jsm#1000
The compose window is notified of the new location so it can subsequently remove intermediate drafts from the new location:
https://searchfox.org/comm-central/rev/6187e08a6cba6e0534369e7a2aea025be66331c6/mailnews/compose/src/MessageSend.jsm#1017
This is a complex matter. Imagine you have two identities. You edit a draft from the first one, while composing, you switch identities. So where you you want a saved draft to go now? Into the old location? Or into the location corresponding to the changed identity? Likely your answer will be: If the identity doesn't change, to the old location, otherwise to the new.
This patch should satisfy what you need, we settled for allowing subfolders of the identity's original draft folder. That should cover identity switching sufficiently:
https://github.com/Betterbird/thunderbird-patches/blob/main/115/bugs/263114-fix-save-draft-to-subfolder.patch
Likely the URL handling can be done more elegantly than with string substitution, but this works for now for IMAP, POP3 and local folders.
Assignee | ||
Comment 44•2 years ago
|
||
This seems to work the way I think the reporters are expected. Reading this got me started:
From comment 30:
Have you tried looking at the aMsgToReplace parameter (nsIMsgDBHdr)?
I think if you're saving this message as draft, then you can check the
parameter is non-null, if it is non-null, then you can get the folder
attribute
(http://hg.mozilla.org/comm-central/annotate/3debe9b1eed2/mailnews/base/
public/nsIMsgHdr.idl#l98) - rv = aMsgToReplace->GetFolder(...) etc.The folder attribute should be pointing at the folder that the original
message was in (as it is the message to replace), and so you should then be
able to store that value in dstFolder, rather than the value obtained by
GetDraftsFolder.
However the parameter aMsgToReplace when doing a save to draft is always null so I had to find something else that determine the currently selected folder, new parameter aTargetMsgToReplace
.
Here's how it works from the user perspective:
-
I'm assuming you have a top level Drafts and several subfolders under it.
-
If you compose a new message and save a draft it goes to the top level draft folder. You have to manually move it to a draft subfolder. (I don't think I saw any requests to allow selection of the subfolder before doing the save.)
-
If you "edit as new" a message in any folder and save a draft, it will go to draft folder of the identity set on the message. If you want it to go to the current account or a different account draft folder you have to set an identify in the message for the correct account.
-
If you edit as draft a messages in a top level Drafts' subfolder, it will save back to the same subfolder. I think this is the main requirement.
I've only tested this with imap draft/draft subfolders on the same imap server (icloud). I haven't tested with drafts in Local Folders or on another server. None of the changes are in imap specific code, so it should work.
Comment 45•2 years ago
|
||
Thanks for presenting an alternative version. We tested IMAP, POP3 and News. POP3 works (local folder, but not "Local Folders"), news (draft in "Local Folders") moves the draft to the top folder (this bug) and IMAP gives the following when pressing Ctrl+S:
GenericSendMessage FAILED: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMsgMessageService.messageURIToMsgHdr]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource:///modules/MessageSend.jsm :: _mimeDoFcc :: line 1032" data: no] MsgComposeCommands.js:6392:13
NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMsgMessageService.messageURIToMsgHdr] _mimeDoFcc resource:///modules/MessageSend.jsm:1032 MsgComposeCommands.js:6303:13
Assignee | ||
Comment 46•2 years ago
•
|
||
Haven't seen a crash (edit: comment 45 shows a error, not a crash) when doing save of draft, even to a subfolder. So not sure what's going on there.
I did notice that editing drafts in subfolders didn't replace the original message but added a new message. This is because the subfolders were not having the ::Drafts flag set. When I set the flag for them, edited message get replaced and a new message is not added to the subfolder.
Also, yes, my patch doesn't help newgroups. For them the edit from a subfolder always goes back into the top level Drafts folder in Local Folders. (Not sure if anyone uses newgroups anymore so may not matter if this features isn't present for those accounts?)
Comment 47•2 years ago
|
||
Jumping on this train quite late, but I think this is also a UX issue.
If the user edits a draft message and saves it, the action should just override the originally opened draft message without changing location.
If you edit as draft a messages in a top level Drafts' subfolder, it will save back to the same subfolder. I think this is the main requirement.
Indeed, Gene, this is the desired result, thank you so much for tackling it.
Could you push your patch to Phabricator and as darktrojan for a review? Even if it's a WIP patch so we can help you out.
Updated•2 years ago
|
Assignee | ||
Comment 48•2 years ago
|
||
Currently a draft edited in a subfolder of Drafts is saved into the
top level Drafts folder and not into the original subfolder.
Ideally this should work for all protocols that support Drafts.
It may be possibe to extend this behavior to Template subfolders also.
Assignee | ||
Updated•2 years ago
|
Comment 49•2 years ago
|
||
From Phab:
But instead of the string manipulation, probably you can get the folder URI from messenger.msgHdrFromURI(uri).folder.URI
Yes, the string manipulation was rather undesirable. Thanks for the hint, we've updated our patch. Tested with IMAP, POP3 and news/Local Folders.
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Comment 50•2 years ago
|
||
if (folderUri?.startsWith(this._folderUri)) {
would be neater since if folderUri
is null the entire term evaluates to null. Gene, can you adjust that and mark the comments "done".
Comment 51•2 years ago
|
||
Another thought: If we want to cater for the deletion of the draft folder, ).folder?.URI
is likely not enough since msgHdrFromURI()
may already fail or return now. There will be no header for the draft/template ID. Worst case, this needs a try/catch, best case, another ?
like so: )?.folder?.URI
. Needs to be tested what happens if the subfolder is deleted while the draft is edited and then saved.
Comment 52•2 years ago
|
||
Correction: ... fail or return null.
Comment 53•2 years ago
|
||
Actually, for this to work at all, the subfolder needs to be a draft folder with the drafts flag. Those folders cannot be deleted or even renamed. You'd have to remove the flag (with an add-on) while editing the draft and then delete the folder. If you do that, nsIMessenger.msgHdrFromURI
fails. So it needs a try/catch.
Assignee | ||
Comment 54•2 years ago
•
|
||
Canceling check-in needed. Need to check what the problems is.
For one thing, I missed Magnus' requested for a change.
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 55•2 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/830feb6bf466
Allow edited drafts or templates in a subfolder to be saved back into the same subfolder. r=mkmelin
Comment 56•2 years ago
|
||
Comment on attachment 9352739 [details]
Bug 263114 - Allow edited drafts or templates in a subfolder to be saved back into the same subfolder. r=darktrojan,mkmelin
[Triage Comment]
Approved for beta
Comment 57•2 years ago
|
||
bugherder uplift |
Thunderbird 119.0b6:
https://hg.mozilla.org/releases/comm-beta/rev/a47a57f8abca
Updated•2 years ago
|
Comment 59•2 years ago
|
||
In 115.4.2 if I move a draft into a subfolder and then open it for editing and save it, the draft is removed from the subfolder and a new draft is created in the main drafts folder. This isn't what I would consider the ideal behavior—I think the draft should be saved in the folder it came from—but it's certainly better than the previous behavior and addresses the specific problem represented by this ticket.
Assignee | ||
Comment 60•2 years ago
|
||
(In reply to Wayne Mery (:wsmwk) from comment #58)
Good for 115?
Probably is.
This isn't something I've looked at since it was pushed to daily over two months ago. It has also been in 119b6 for a month.
The only comment I see is
(Jonathan Kamens from comment #59)
In 115.4.2 if I move a draft into a subfolder and then open it for editing and save it, the draft is removed from the subfolder and a new draft is created in the main drafts folder. This isn't what I would consider the ideal behavior—I think the draft should be saved in the folder it came from—but it's certainly better than the previous behavior and addresses the specific problem represented by this ticket.
and I don't exactly understand since, AFAIK, this patch is not yet in 115 at all and only in beta. So with beta, if you edit a draft in a subfolder of Drafts it will be saved back to the same subfolder as was specifically requested by the reporter in comment 0 and by more recent comments starting at comment 36.
Updated•2 years ago
|
Comment 61•2 years ago
|
||
Comment on attachment 9352739 [details]
Bug 263114 - Allow edited drafts or templates in a subfolder to be saved back into the same subfolder. r=darktrojan,mkmelin
[Triage Comment]
Approved for esr115
Comment 62•2 years ago
|
||
bugherder uplift |
Thunderbird 115.5.2:
https://hg.mozilla.org/releases/comm-esr115/rev/73800b0d4579
Description
•