IMAP Draft messages are marked as read (and thus won't be noticed)

VERIFIED FIXED in Thunderbird 3.3a1

Status

Thunderbird
Mail Window Front End
VERIFIED FIXED
9 years ago
5 years ago

People

(Reporter: Ben, Assigned: standard8)

Tracking

(Depends on: 1 bug, Blocks: 1 bug, {regression})

unspecified
Thunderbird 3.3a1
regression
Dependency tree / graph
Bug Flags:
wanted-thunderbird +
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008112522 Firefox/3.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20081204 Thunderbird/3.0b1

In an IMAP account, when saving a draft (through autosave?), it does not show in the draft folder until you click on the folder. It should however automatically update the contents of Drafts when saving a message there.

This is important because when it doesn't see the draft that has been saved by autosave, it is not deleted.

thanks

Reproducible: Always

Steps to Reproduce:
1. Compose new message ... take your time so it does an autosave
2. Send the message before IMAP explicitely checks (like every 10 min)
3. Go into Drafts folder --> there's your undeleted message

Thunderbird didn't know that it was there.
If you click on drafts before you send the message, and then you see it loads the message into the folder -- if you send the message then, then it gets deleted, but otherwise not.

Comment 1

9 years ago
Well on IMAP the drafts are marked as read, but on POP they are unread... I suppose that's the bug here. 

(I don't see the problem with drafts not getting deleted.)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: IMAP: does not refresh Draft folder when saving a draft → IMAP Draft messages are marked as read (and thus won't be noticed)
(Reporter)

Comment 2

9 years ago
Autosaves should get deleted though.
If I spend an hour writing an email (for example), then I have 6 autosave drafts in my draft folder, which eventually show up unread.
That's not ideal behavior.
Autosave drafts should get deleted once the message is sent, and on top of that, autosave drafts should overwrite each other and not just add to the list.
And I suppose autosaves should be marked as read, so as not to distract.

I don't know, I'm still using Thunderbird 3.0b1
Component: General → Mail Window Front End
QA Contact: general → front-end
(In reply to comment #1)
> Well on IMAP the drafts are marked as read, but on POP they are unread...

Following is IMAP log of "Save As Draft", with Gmail IMAP & Tb trunk. 
> [1524] 2068[75bed98]: 75b5f90:imap.gmail.com:S-Drafts:SendData: 9 append "Drafts" (\Seen \Draft) {529}
Tb explicitly requests \Seen upon APPEND to "Drafts".
"Adding of \Seen" was done in the past by user's request? (for example, stop annoying new mail notification for each saved draft mail. If draft is saved in Inbox, it'll easily/frequently occur.)

Updated

8 years ago
Flags: wanted-thunderbird3?
Hardware: x86 → All
Apparently this is a regression from bug 198087, fixed clear back in 2004. I'm not currently able to track down when the regression happened (hg+CVS+inexperience_with_Mozilla_tools = fun), but looking at that bug, it would appear the fix went into http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/mailnews/imap/src/nsImapMailFolder.cpp&rev=1.638#4394 -- however, there are no obvious signs of it in e.g. http://hg.mozilla.org/comm-central/file/tip/mailnews/imap/src/nsImapMailFolder.cpp

I can't find any bugs that deliberately reversed this, so I'd guess it happened somewhat by accident.

(In reply to comment #3)
> "Adding of \Seen" was done in the past by user's request? (for example, stop
> annoying new mail notification for each saved draft mail. If draft is saved in
> Inbox, it'll easily/frequently occur.)
No, in point of fact it was taken out in the past by users' request -- TB does not notify on new unread messages in the Draft folder anyway, and if you're saving drafts in the Inbox, well... "Doctor, it hurts when I do this!"

IMO, this bug is chiefly about the utility of remembering that you have unsent drafts in your Drafts folder.
Keywords: regression, regressionwindow-wanted
(Assignee)

Comment 5

7 years ago
(In reply to comment #4)
> I can't find any bugs that deliberately reversed this, so I'd guess it happened
> somewhat by accident.

It could have been bug 301084, but I'm not 100% convinced without going back and retesting everything.
Flags: wanted-thunderbird3? → wanted-thunderbird+
(Assignee)

Comment 6

7 years ago
Created attachment 435566 [details] [diff] [review]
Possible fix

This seems to fix the bug, however it appears IMAP servers won't update the unread count until you select the folder (or you already have the folder selected).

I'd have thought that because this is a message copy, it should be updating the count on getting the "new" message into the found. Unless for some weird reason we'll only do that on checking for new mail, and hence would need the check for new mail preference set on the folder.

I think David should have a few better ideas, so requesting feedback from him.
Attachment #435566 - Flags: feedback?(bienvenu)

Comment 7

7 years ago
Comment on attachment 435566 [details] [diff] [review]
Possible fix

this looks reasonable, yeah.
Attachment #435566 - Flags: feedback?(bienvenu) → feedback+
(Assignee)

Updated

7 years ago
Assignee: nobody → bugzilla
(Assignee)

Comment 8

7 years ago
Comment on attachment 435566 [details] [diff] [review]
Possible fix

Getting ui-review. Bryan this will make it so that drafts saved into imap folders will be unread - just the same as for Local Folders.

I suspect this patch needs a couple of tweaks and a unit test, but wanted to get your review before proceeding.

I suspect this may expose some bugs as well (e.g. multiple copies that I've seen mentioned occasionally), but that should be a good thing.
Attachment #435566 - Flags: ui-review?(clarkbw)
(Assignee)

Updated

7 years ago
Keywords: regressionwindow-wanted
Comment on attachment 435566 [details] [diff] [review]
Possible fix

sounds good to me
Attachment #435566 - Flags: ui-review?(clarkbw) → ui-review+
(Assignee)

Comment 10

7 years ago
Created attachment 485680 [details] [diff] [review]
Fix with unit test

This fixes it and adds a couple of unit tests. I was having issues with the imap test hanging on shutdown, but I think that is down to bug 606052 as I can't reproduce now.
Attachment #435566 - Attachment is obsolete: true
Attachment #485680 - Flags: review?(bienvenu)

Comment 11

7 years ago
Comment on attachment 485680 [details] [diff] [review]
Fix with unit test

Don't think you want this copied comment:

+/*
+ * This file tests recognizing a message as junk due to
+ *  SpamAssassin headers, and marking that as good
+ *  without having the message return to the junk folder,
+ *  as discussed in bug 540385.
+ *
+ * adapted from test_filterNeedsBody.js
+ */

don't think this is used:

+// Globals
+const gMessage = "SpamAssassinYes"; // message file used as the test message
+

might as well remove the commented out line:
+  {
+    dl('msgsMoveCopyCompleted to folder ' + aDestFolder.name);
+//    async_driver();


do you really want the +++ b/mailnews/test/resources/mailShutdown.js changes?
Attachment #485680 - Flags: review?(bienvenu) → review+
(Assignee)

Comment 12

7 years ago
(In reply to comment #11)
> do you really want the +++ b/mailnews/test/resources/mailShutdown.js changes?

I was debating keeping them because of the issues we've had with tests on shutdown, but I think I'll leave those out for now.
(Assignee)

Comment 13

7 years ago
Checked in: http://hg.mozilla.org/comm-central/rev/0930e772903b
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.3a1

Comment 14

7 years ago
Just noticed this change by writing email, looks good.
Status: RESOLVED → VERIFIED

Comment 15

7 years ago
Mark, any chance this could be backported to 3.1 tree, w/o breaking stuff?
(Assignee)

Comment 16

7 years ago
(In reply to comment #15)
> Mark, any chance this could be backported to 3.1 tree, w/o breaking stuff?

This won't be backported to 3.1.x because it is effectively a change of user experience, and whilst a regression, I don't really want to change it on a stable branch. I'm also suspecting it may highlight some existing bugs in saving drafts.

Updated

7 years ago
Blocks: 624770

Comment 17

6 years ago
Although I like the idea of this fix, it introduces a regression with other clients, in this case with GMail (for Android), which is probably caused by a chain of other bugs. Would it be possible to make this feature configurable?

Here is what happens:
When I write an email reply with auto save on, it creates several drafts which are now all unread. This causes GMail for Android to include _all_ of them into the conversation the reply belongs to, also as unread mails. To make things worse, when the mail is sent, the drafts are moved (if you are lucky) to trash but remain marked as unread. So at the end of the day you end up with a conversation that unnecessarily contains a bunch of drafts of different states from the drafts and/or the trash folder.

Restarting TB and compacting the drafts folder helps sometimes to clean up the mess.

I'd just like to bring this "regresssion" to attention, if I shall file a new bug for this I'm happy to do this.
Tammo please file new bug(s).

Comment 19

6 years ago
Done. See Bug 673400.

Updated

6 years ago
Duplicate of this bug: 476840

Comment 21

6 years ago
Mark Banner and David Bienvenu, may I ask you have a look at Bug 673400 and the patch I attached to it? It aims at making the result of the fix of this bug configurable because marking drafts unread turns out to be very, very annoying when using Thunderbid in conjunction with GMail and Android devices. I attached an untested patch (due to lack of dev environment) but I hope it may serve as a starting point for a Mozialla TB dev. Thanks in advance.
Depends on: 673400
You need to log in before you can comment on or make changes to this bug.