Bug 1845206 - Add message filters to the folder pane context menu. r=freaktechnik

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

--HG--
extra : rebase_source : 7bdd2fee721ac975c7f0c4710c8ea916b49d2cb8
extra : amend_source : 65f37a395d4f3993609ddf26182b3dcf041f2316
This commit is contained in:
Geoff Lankow 2024-07-04 14:13:31 +12:00
Родитель 2c8dc276ff
Коммит 607615b8bc
3 изменённых файлов: 37 добавлений и 5 удалений

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

@ -659,6 +659,7 @@ var folderPaneContextMenu = {
this._showMenuItem("folderPaneContext-markAllFoldersRead", isServer);
this._showMenuItem("folderPaneContext-settings", isServer);
this._showMenuItem("folderPaneContext-filters", isServer);
this._showMenuItem("folderPaneContext-manageTags", isSmartTagsFolder);
@ -728,6 +729,7 @@ var folderPaneContextMenu = {
this._showMenuItem("folderPaneContext-sendUnsentMessages", false);
this._showMenuItem("folderPaneContext-markAllFoldersRead", false);
this._showMenuItem("folderPaneContext-settings", false);
this._showMenuItem("folderPaneContext-filters", false);
this._showMenuItem("folderPaneContext-manageTags", false);
// Show only the standard commands that don't require special conditions.
@ -915,6 +917,9 @@ var folderPaneContextMenu = {
case "folderPaneContext-settings":
folderPane.editFolder(folder);
break;
case "folderPaneContext-filters":
topChromeWindow.MsgFilters(undefined, folder);
break;
case "folderPaneContext-manageTags":
goDoCommand("cmd_manageTags");
break;

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

@ -506,6 +506,10 @@
class="menuitem-iconic"
label="&folderContextSettings2.label;"
accesskey="&folderContextSettings2.accesskey;"/>
<menuitem id="folderPaneContext-filters"
class="menuitem-iconic"
label="&filtersCmd2.label;"
accesskey="&filtersCmd2.accesskey;"/>
<menuitem id="folderPaneContext-manageTags"
class="menuitem-iconic"
label="&manageTags.label;"

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

@ -66,6 +66,7 @@ const folderPaneContextData = {
"folderPaneContext-properties": [...realFolders, "virtual", "nntpGroup"],
"folderPaneContext-markAllFoldersRead": [...servers],
"folderPaneContext-settings": [...servers],
"folderPaneContext-filters": [...servers],
"folderPaneContext-manageTags": ["tags"],
};
@ -475,9 +476,13 @@ add_task(async function testNewRenameDelete() {
});
/**
* Tests "Properties" (folders) and "Settings" (servers).
* Tests "Properties" (folders), "Settings" and "Message Filters" (servers).
*/
add_task(async function testPropertiesSettings() {
add_task(async function testPropertiesSettingsFilters() {
// Open a folder that isn't the subject of this test. This proves that these
// menu commands used the right-clicked-on folder, not the current folder.
leftClickOn(inboxFolder);
const folderPropsPromise = BrowserTestUtils.promiseAlertDialog(
undefined,
"chrome://messenger/content/folderProps.xhtml",
@ -497,7 +502,6 @@ add_task(async function testPropertiesSettings() {
},
}
);
leftClickOn(plainFolder);
await rightClickAndActivate(plainFolder, "folderPaneContext-properties");
await folderPropsPromise;
@ -524,7 +528,6 @@ add_task(async function testPropertiesSettings() {
},
}
);
leftClickOn(virtualFolder);
await rightClickAndActivate(virtualFolder, "folderPaneContext-properties");
await virtualPropsPromise;
@ -532,7 +535,6 @@ add_task(async function testPropertiesSettings() {
tabmail.tabContainer,
"TabOpen"
);
leftClickOn(rootFolder);
await rightClickAndActivate(rootFolder, "folderPaneContext-settings");
const {
detail: { tabInfo },
@ -556,6 +558,27 @@ add_task(async function testPropertiesSettings() {
"account should be selected"
);
tabmail.closeTab(tabInfo);
const filtersPromise = BrowserTestUtils.promiseAlertDialog(
undefined,
"chrome://messenger/content/FilterListDialog.xhtml",
{
async callback(win) {
await SimpleTest.promiseFocus(win);
const doc = win.document;
const serverMenu = doc.getElementById("serverMenu");
Assert.equal(serverMenu.value, rootFolder.URI);
EventUtils.synthesizeKey("KEY_Escape", {}, win);
},
}
);
await rightClickAndActivate(rootFolder, "folderPaneContext-filters");
await filtersPromise;
await SimpleTest.promiseFocus(window);
});
/**