Skip to content

Commit

Permalink
Allow to reply to a collapsed message thread
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Oct 4, 2024
1 parent f23d97a commit d7f0eef
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions webextensions/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,26 @@ function defineContextMenuItemsFor(definition) {
}


async function startTypicalReply(params) {
async function startTypicalReply(params, message) {
log(`startTypicalReply: `, params);
if (!params)
return;

const tabs = await browser.tabs.query({ active: true, windowId: browser.windows.WINDOW_ID_CURRENT });
if (tabs.length == 0)
return;

const tab = tabs[0];
const message = await browser.messageDisplay.getDisplayedMessage(tab.id);
log('original message: ', message);
if (!message) {
const tabs = await browser.tabs.query({ active: true, windowId: browser.windows.WINDOW_ID_CURRENT });
log('tabs: ', tabs);
if (tabs.length == 0)
return;

const tab = tabs[0];
message = await browser.messageDisplay.getDisplayedMessage(tab.id);
log('original message: ', message);
if (!message) {
const messages = await browser.mailTabs.getSelectedMessages(tab.id);
log('selected messages: ', messages);
return Promise.all(messages.messages.map(message => startTypicalReply(params, message)));
}
}

const composeInfo = await new Promise(async (resolve, _reject) => {
lastComposingResolver = resolve;
Expand Down

0 comments on commit d7f0eef

Please sign in to comment.