Open Bug 1921968 Opened 1 year ago Updated 8 months ago

[ews] Multiple folders appearing to have the same flag when using the test account

Categories

(Thunderbird :: Account Manager, defect)

defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: babolivier, Assigned: edicharry, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

When syncing folders via EWS using the test account, we end up with multiple folders visually showing the same flag, which looks a bit confusing.

All these folders do seem to exist when viewed in Outlook, but "Sent" and "Trash" don't have a special symbol there (unlike "Sent Items" and "Deleted Items").

I'm wondering if this might be some other code around folder flags/name management noticing the specific names for "Sent" and "Trash" and either applying the corresponding folder flags onto them, or even simply showing a specific icon for these names.

For IMAP, we have support for "Special Use" flags, which is an IMAP extension where the server tells the client which is the sent folder, trash folder etc. I had implemented the support in IMAP back then. In EWS, that feature is built into the protocol, so you should always have that information.

Then, Thunderbird has other code which sets the special folder flags based on their name only. This is from the time before IMAP Special Use existed, and for servers that don't support it. So, this is a completely different implementation with the same goal. You likely have both being active: "Sent Items" is flagged as Sent folder from EWS, where as "Sent" is a folder created by Thunderbird and set as Sent folder based on its name.

To further complicate the situation, not all special folders are created at the same time, in the same code place. Thunderbird creates the Trash folder very early, IIRC even before connecting to the server, because it wants to always be able to delete messages.

So, IIRC, there is code to later rectify that: The Trash or other special folder set earlier in the process can be unset and changed to another Trash folder after connecting to the server. In fact, you need that anyways, because the server may decide to now send another folder as Archive folder, so you need to be able to change it, anyways.

To add another layer of complexity, the user can also change the special folder in settings.

I was tearing hairs when I had to implement this. But luckily, you should be able to just follow the IMAP Special Use implementation, and it should mostly work.

Have fun with this! ;-)

Assignee: nobody → edicharry
Status: NEW → ASSIGNED

I can't reproduce this anymore. Part of the reason is because added a process similar to what is described above, where on sync, we detect what EWS calls the distinguished folder, set its trash flag, and write a local pref that's used in the future to identify the trash folder in lieu of the distinguished folder. I haven't been able to replicate the same behavior at all with the sent folder, even if I delete them completely on the server and start with a fresh profile. Also, neither a folder named "Trash" nor a folder named "Sent" are created automatically on startup anymore.

There is one issue in the code where, when we add a subfolder, if the name happens to be "Trash", we set the trash flag. For EWS, the process described above corrects for this on sync. I can remove that, but I'm not sure what else it will break. I try that and submit a try run to see what happens.

Brendan, is there anything else you see as needing to happen as part of this issue?

Flags: needinfo?(brendan)

Removing the automatic folder setting in AddSubfolder appears to be very bad for tests, see https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=fbecf061e481e43da150214b1531c41003b57453 .

Since this doesn't appear to be a direct issue anymore for EWS, I'm thinking it's better to move on to other things, but Brendan, please let me know if you disagree.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: