- commit
- cd72be6718a52bcdfa15f03874ac8e9672dfc03b
- parent
- 32290481fa16c789d974c092fc6cd923128f4ff3
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-12-23 17:29
add fallback for messages that are not index fixes #1 it seems like browser.messages.query() does the job, but it is slow.
Diffstat
| M | src/js/main.js | 13 | ++++++++++++- |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/js/main.js b/src/js/main.js
@@ -8,7 +8,18 @@ var initialIDs = (util.getParams().ids || '').split(',');
8 8 var container = document.querySelector('.conversation__main');
9 9 var anyExpanded = false;
10 10
11 -1 browser.xi.getConversation(initialIDs).then(function(conversation) {
-1 11 var getMessageForId = function(id) {
-1 12 return browser.messages.query({headerMessageId: id}).then(page => {
-1 13 if (!page.messages.length) {
-1 14 throw null;
-1 15 }
-1 16 return page.messages[0];
-1 17 });
-1 18 };
-1 19
-1 20 browser.xi.getConversation(initialIDs).catch(() => {
-1 21 return Promise.all(initialIDs.map(getMessageForId));
-1 22 }).then(function(conversation) {
12 23 var subject = conversation[0].subject || '(no subject)';
13 24 document.querySelector('.conversation__subject').textContent = subject;
14 25 document.title = subject;