While working on bug 1880014 I noticed that when messages in Inbox were archived (with include directory option) that Inbox folder was never created. All other folders had their folder name created. I thought it was maybe related to bug 1880014 but found this. Also, the example show in the archiving options show, for maintaining folder structure, "Inbox" as an example. I tried the change suggest in comment 15 and comment 16 and it fixes the issue so a message archived from Inbox now appears in an Inbox folder under archives. ``` diff --git a/mail/modules/MessageArchiver.sys.mjs b/mail/modules/MessageArchiver.sys.mjs --- a/mail/modules/MessageArchiver.sys.mjs +++ b/mail/modules/MessageArchiver.sys.mjs @@ -285,25 +285,24 @@ MessageArchiver.prototype = { } } } // Create the folder structure in Archives. // For imap folders, we need to create the sub-folders asynchronously, // so we chain the actions using the listener called back from // createSubfolder. For local, createSubfolder is synchronous. if (archiveFolder.canCreateSubfolders && batch.keepFolderStructure) { - // Collect in-order list of folders of source folder structure, - // excluding top-level INBOX folder + // Collect in-order list of folders of source folder structure. const folderNames = []; const rootFolder = srcFolder.server.rootFolder; const inboxFolder = lazy.MailUtils.getInboxFolder(srcFolder.server); let folder = srcFolder; - while (folder != rootFolder && folder != inboxFolder) { + while (folder != rootFolder) { folderNames.unshift(folder.name); folder = folder.parent; } // Determine Archive folder structure. for (let i = 0; i < folderNames.length; ++i) { const folderName = folderNames[i]; if (!dstFolder.containsChildNamed(folderName)) { // Create Archive sub-folder (IMAP: async). if (isAsync) { ``` I tried this with and without "INBOX." as the personal namespace and with and without INBOX. as the imap server directory. Also, tried it on POP3 account and seems OK there too. See comment 9 for theory as to why excluding Inbox is intentional. If there really is a valid reason for keeping this the way it currently is, at least the archiving examples in the UI need to show a different folder than Inbox since, the way it works now, an Inbox folder is NEVER created under the archive folder.
Bug 697706 Comment 17 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
While working on bug 1880014 I noticed that when messages in Inbox were archived (with include directory option) that Inbox folder were never created. All other folders had their folder name created. I thought it was maybe related to bug 1880014 but found this. Also, the examples in the archiving option dialog show, for maintaining folder structure, "Inbox" as the only example. I tried the change suggest in comment 15 and comment 16 and it fixes the issue so a message archived from Inbox now appears in an Inbox folder created under archives. ``` diff --git a/mail/modules/MessageArchiver.sys.mjs b/mail/modules/MessageArchiver.sys.mjs --- a/mail/modules/MessageArchiver.sys.mjs +++ b/mail/modules/MessageArchiver.sys.mjs @@ -285,25 +285,24 @@ MessageArchiver.prototype = { } } } // Create the folder structure in Archives. // For imap folders, we need to create the sub-folders asynchronously, // so we chain the actions using the listener called back from // createSubfolder. For local, createSubfolder is synchronous. if (archiveFolder.canCreateSubfolders && batch.keepFolderStructure) { - // Collect in-order list of folders of source folder structure, - // excluding top-level INBOX folder + // Collect in-order list of folders of source folder structure. const folderNames = []; const rootFolder = srcFolder.server.rootFolder; const inboxFolder = lazy.MailUtils.getInboxFolder(srcFolder.server); let folder = srcFolder; - while (folder != rootFolder && folder != inboxFolder) { + while (folder != rootFolder) { folderNames.unshift(folder.name); folder = folder.parent; } // Determine Archive folder structure. for (let i = 0; i < folderNames.length; ++i) { const folderName = folderNames[i]; if (!dstFolder.containsChildNamed(folderName)) { // Create Archive sub-folder (IMAP: async). if (isAsync) { ``` I tried this with and without "INBOX." as the personal namespace and with and without INBOX. as the imap server directory. Also, tried it on POP3 account and seems OK there too. See comment 9 for theory as to why excluding Inbox is intentional. If there really is a valid reason for keeping this the way it currently is, at least the archiving examples in the UI need to show a different folder than Inbox since, the way it works now, an Inbox folder is NEVER created under the archive folder.