Bug 1851975 - Get default sort for synthetic views from preferences. r=mkmelin

The default sort order and type for synthetic views such as conversations are hard coded. Use
the `mailnews.default_sort_order` and `mailnews.default_sort_type` preferences instead.

This patch also restores the missing sort indicator when a synthetic view is opened.

Differential Revision: https://phabricator.services.mozilla.com/D200067

--HG--
extra : moz-landing-system : lando
This commit is contained in:
welpy-cw 2024-02-05 17:20:04 +00:00
Родитель 132c475a97
Коммит ba52261a00
3 изменённых файлов: 18 добавлений и 8 удалений

Просмотреть файл

@ -5681,6 +5681,7 @@ function restoreState({
document.title = title;
document.body.classList.remove("account-central");
accountCentralBrowser.hidden = true;
threadPane.restoreSortIndicator();
threadPaneHeader.onFolderSelected();
window.dispatchEvent(

Просмотреть файл

@ -742,7 +742,7 @@ add_task(async function testListMessage() {
*/
add_task(async function testSyntheticFolder() {
await TestUtils.waitForCondition(
() => ConversationOpener.isMessageIndexed(testMessages[9]),
() => ConversationOpener.isMessageIndexed(testMessages[5]),
"waiting for Gloda to finish indexing",
1000
);
@ -760,7 +760,7 @@ add_task(async function testSyntheticFolder() {
syntheticView: new GlodaSyntheticView({
collection: Gloda.getMessageCollectionForHeaders([
...draftsMessages,
...testMessages.slice(6),
...testMessages.slice(0, 6),
]),
}),
title: "Test gloda results",
@ -777,9 +777,9 @@ add_task(async function testSyntheticFolder() {
let loadedPromise = BrowserTestUtils.browserLoaded(
messagePaneBrowser,
undefined,
url => url.endsWith(gDBView.getKeyAt(0))
url => url.endsWith(gDBView.getKeyAt(9))
);
threadTree.selectedIndex = 0;
threadTree.selectedIndex = 9;
await loadedPromise;
// Open the menu from the message pane.
@ -799,7 +799,7 @@ add_task(async function testSyntheticFolder() {
// Open the menu from the thread pane.
EventUtils.synthesizeMouseAtCenter(
threadTree.getRowAtIndex(0),
threadTree.getRowAtIndex(9),
{ type: "contextmenu" },
about3Pane
);
@ -809,9 +809,9 @@ add_task(async function testSyntheticFolder() {
loadedPromise = BrowserTestUtils.browserLoaded(
messagePaneBrowser,
undefined,
url => url.endsWith(gDBView.getKeyAt(5))
url => url.endsWith(gDBView.getKeyAt(4))
);
threadTree.selectedIndex = 5;
threadTree.selectedIndex = 4;
await loadedPromise;
// Open the menu from the message pane.

Просмотреть файл

@ -45,7 +45,16 @@ function GlodaSyntheticView(aArgs) {
}
GlodaSyntheticView.prototype = {
defaultSort: [
[Ci.nsMsgViewSortType.byDate, Ci.nsMsgViewSortOrder.descending],
[
Services.prefs.getIntPref(
"mailnews.default_sort_type",
Ci.nsMsgViewSortType.byDate
),
Services.prefs.getIntPref(
"mailnews.default_sort_order",
Ci.nsMsgViewSortOrder.descending
),
],
],
/**