Closed Bug 1984945 Opened 6 months ago Closed 3 months ago

"File | Compact Folders" does nothing when multiple folders selected in an account except emit a console error.

Categories

(Thunderbird :: Mail Window Front End, defect)

Thunderbird 115
defect

Tracking

(thunderbird_esr128 wontfix, thunderbird_esr140 affected, thunderbird146 wontfix, thunderbird147 fixed)

RESOLVED FIXED
147 Branch
Tracking Status
thunderbird_esr128 --- wontfix
thunderbird_esr140 --- affected
thunderbird146 --- wontfix
thunderbird147 --- fixed

People

(Reporter: gds, Assigned: gds)

References

Details

Attachments

(1 file, 3 obsolete files)

STR:

  • Select 2 or more folders in an any account, e.g., an imap account.
  • Select File menu and then "Compact Folders"
  • Nothing happens
  • But console prints An error occurred executing the cmd_compactFolder command: TypeError: can't access property "isServer", folder is null

The same thing happens if you

  • Select 2 or more accounts (i.e., server root folders)
  • Select File menu and then "Compact Folders"
  • Nothing happens
  • But console prints An error occurred executing the cmd_compactFolder command: TypeError: can't access property "isServer", folder is null

I noticed this recently while working on another bug but found that I previously reported this at bug 1853584 comment 39 thinking when that bug is fix that this would be too. But since nothing has been done on Bug 1853584 I decided to go ahead and report this issue as separate bug.

The problem is occurring here because folder or maybe gFolder is null when 2 or more folders (or accounts) are selected:
https://searchfox.org/comm-central/rev/536682ef9c988861f52cfa5e69f166841a8f7859/mail/base/content/about3Pane.js#6697-6706

I'll look closer and see if I can find a fix.

Attached patch compact-folders-fix-v0.diff (obsolete) — Splinter Review

Not sure why gFolder is null but apparently the same issue occurs when doing delete of multiple selected folders as seen here: https://searchfox.org/comm-central/rev/bb599d97d564c3f3464debc5d68b0f61cb48373e/mail/base/content/about3Pane.js#6682
Doing a similar thing for cmd_compactfolder callback registration fixes the problem.
The proposed patch causes menu item "Compact Folders" to do the same things as right-click "Compact" for currently selected folders or accounts.
I think this patch might also resolve bug 1853584 if we also change the menu item wording from Compact Folders to just Compact.
In addition, the documentation needs to be fixed here: https://support.mozilla.org/en-US/kb/compacting-folders#w_when-does-compact-occur. It doesn't mention anything about selecting multiple folders or accounts. It also implies that File -> Compact Folders affects all the folders if any one folder in an account is selected. It should say something like this:

(Corrected this 8-29-25, in bold)
A compact happens when:

  • You right-click a folder and select Compact to compact a single folder
  • You select (click) a single folder or multiple folders in the same account one or more accounts using using ctrl-click (or select a contiguous range of folders using click and then shift-click, but excluding any accounts), and compact them by right-clicking on any of the selected folders or by doing menu command File -> Compact.
  • You select (click) a single account at top level or multiple accounts at the top level using ctrl-click (or select a contiguous range of accounts using click and then shift-click, but excluding any folders) and then compact all the folders in the selected account(s) by right-click on a selected account or by using menu command File -> Compact.
  • You select File > Compact Folders to compact all folders in an account <-- no longer true unless the top level account(s) is/are selected, which is covered by the previous (3rd) bullet.
Assignee: nobody → gds

Also rename "File | Compact Folders" to "File | Compact" and change accesskey
from "F" to "m".

Version: unspecified → Thunderbird 115

With a single message folder selected, File menu and folder context menus show:
"Compact Folder"
With multiple message folders selected, File menu and folder context menu show:
"Compact Folders"
With a single or multiple servers selected, File menu and folder context menu show:
"Compact All Folders"
On right-click of unselected message folder, folder context menu shows:
"Compact Folder"
On right-click of unselected server, folder context menu shows:
"Compact All Folders"
With mixed selection of message folders and servers, compact menu items are disabled (this is not a change).
Requires new variant strings so migration script not appropriate for this patch.
Uses a "number variable" in the *.ftl files to select the appropriate string.
For all strings, accesskey is 'F'.
Based on similar functionality as menus and strings for "Mark Folder(s) Read".

Attachment #9509400 - Attachment is obsolete: true

I've taken a new approach as seen in comment 3 patch. If this is OK, I'll just abandon comment 2 patch.

Attachment #9509611 - Attachment is obsolete: true
Attached patch compact-folders-fix-v6.diff (obsolete) — Splinter Review

I think this is OK but just saving here before submitting again for review.

Attachment #9522723 - Attachment is obsolete: true

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/0640a9b61e9b
Harmonize File folder compact menu with folder context compact menu. r=mkmelin,tobyp

Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/fa97ea83d975 follow-up, fix linting. rs=lint
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: