Closed Bug 1877390 Opened 2 years ago Closed 2 years ago

Evaluate to use columnIds instead of sortType for sorting in about3pane.js

Categories

(Thunderbird :: Folder and Message Lists, task)

task

Tracking

(Not tracked)

RESOLVED FIXED
126 Branch

People

(Reporter: john, Assigned: john)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

We are exposing custom column support for WebExtensions and we use existing custom-column code. It looks that old code has been patched in to make it work, but there seems to have been no planing. The mentioned function accepts an integer and a string and passes this on further and every function on the way has to deal with this.

Let us fix that, before exposing that code to the public.

Assignee: nobody → john

The function convertSortTypeToColumnID() uses dbView.curCustomColumn to
convert the "byCustom" sort type to a folderId. This however only works
for the current sort column, and not for any sort column. It is also
only used with the primarySortType as input.

To improve readability of this code, this patch reworks this function to
always return to columnID of the current sort column.

Depends on D200186

Summary: Rework sortControler.sortThreadPane() to accept a columnId instead of a sortkey → Evaluate to use columnIds instead of sortType for sorting in about3pane.js

In threadPane.js exists similar code as in about3pane.ja, to convert the
sort type of the current sort column into a columnId.
This patch moves these functions as an additional getter into DBViewWrapper.jsm.

To avoid circular dependecies, this patch moves OUTGOING_FOLDER_FLAGS
from DBViewWrapper.jsm to FolderUtils.jsm.

Depends on D200212

Both maps can be generated from DEFAULT_COLUMNS and do not need to be
maintained manually.

While modifying the maps, I learned that one of their use-cases in
HandleColumnClick() in threadPane.js can be simplified using the new
getter for primarySortColumnId.

Depends on D200242

This continues the effort to remove redundant code. The relation
between sortType and columnId is defined in DEFAULT_COLUMNS and does not
need to be hard-coded in the DBViewWrapper.primarySortColumnId getter.

Depends on D200276

Attachment #9377544 - Attachment description: WIP: Bug 1877390 - Next → Bug 1877390 - Move special custom column sort handling into DBViewWrapper.jsm and primarily use columnIds instead of sortTypes for sorting. r=#thunderbird-front-end-reviewers
Attachment #9377591 - Attachment description: Bug 1877390 - Generate COLUMNS_MAP and COLUMNS_MAP_NOSORT and simplify HandleColumnClick() in threadPane.js. r=#thunderbird-front-end-reviewers → Bug 1877390 - Generate the BUILTIN_SORT_COLUMNS Map and the BUILTIN_NOSORT_COLUMNS Set, and simplify HandleColumnClick() in threadPane.js. r=#thunderbird-front-end-reviewers
Blocks: 1880598
Blocks: 1882042
Target Milestone: --- → 126 Branch
Status: NEW → ASSIGNED

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/ef7c78ff16d1
Rework sortController.convertSortTypeToColumnID() to sortControler.getCurrentSortColumnId(). r=freaktechnik
https://hg.mozilla.org/comm-central/rev/23311496b022
Reduce code duplication in about3pane.js and threadPane.js. r=aleca
https://hg.mozilla.org/comm-central/rev/5d723e9f3e1c
Generate the BUILTIN_SORT_COLUMNS Map and the BUILTIN_NOSORT_COLUMNS Set, and simplify HandleColumnClick() in threadPane.js. r=aleca
https://hg.mozilla.org/comm-central/rev/592f757bb8a8
Simplify the DBViewWrapper.primarySortColumnId getter and remove redundancy. r=aleca
https://hg.mozilla.org/comm-central/rev/dbea62484f51
Move special custom column sort handling into DBViewWrapper.jsm and primarily use columnIds instead of sortTypes for sorting. r=aleca

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Regressions: 1889036
Regressions: 1890044
See Also: → 1893799
Regressions: 1894896
Regressions: 1935073
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: