Bug 1579805 - Allow browser.messages.query to find read or unread messages. r=mkmelin
This commit is contained in:
Родитель
2c956ca04b
Коммит
1cf20d0301
|
@ -203,6 +203,12 @@ this.messages = class extends ExtensionAPI {
|
|||
});
|
||||
});
|
||||
|
||||
if (queryInfo.unread !== null) {
|
||||
collectionArray = collectionArray.filter(
|
||||
msg => msg.isRead == !queryInfo.unread
|
||||
);
|
||||
}
|
||||
|
||||
return messageListTracker.startList(
|
||||
collectionArray,
|
||||
context.extension
|
||||
|
|
|
@ -115,6 +115,11 @@
|
|||
"optional": true,
|
||||
"description": "Returns only messages with one or more recipients matching any configured identity."
|
||||
},
|
||||
"unread": {
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
"description": "Returns only unread (or read if false) messages."
|
||||
},
|
||||
"flagged": {
|
||||
"type": "boolean",
|
||||
"optional": true,
|
||||
|
|
|
@ -32,6 +32,7 @@ add_task(async function setup() {
|
|||
|
||||
let messages = [...subFolders.test1.messages];
|
||||
// NB: Here, the messages are zero-indexed. In the test they're one-indexed.
|
||||
messages[0].markRead(true);
|
||||
messages[1].markFlagged(true);
|
||||
messages[6].markFlagged(true);
|
||||
|
||||
|
@ -138,6 +139,10 @@ add_task(async function() {
|
|||
await subtest({ fromDate: date1, toDate: date2 });
|
||||
await subtest({ fromDate: date2, toDate: date1 }, 4, 5, 6);
|
||||
|
||||
// Unread query. Only message 1 has been read.
|
||||
await subtest({ unread: false }, 1);
|
||||
await subtest({ unread: true }, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
|
||||
// Flagged query. Messages 2 and 7 are flagged.
|
||||
await subtest({ flagged: true }, 2, 7);
|
||||
await subtest({ flagged: false }, 1, 3, 4, 5, 6, 8, 9);
|
||||
|
|
Загрузка…
Ссылка в новой задаче