Skip to content

Commit

Permalink
Merge pull request #1 from clear-code/allow-to-reply-to-collapsed-thread
Browse files Browse the repository at this point in the history
Support collapsed thread and no message pane case
  • Loading branch information
HashidaTKS authored Oct 24, 2024
2 parents f23d97a + efc0a61 commit d7ea790
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 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
2 changes: 1 addition & 1 deletion webextensions/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "2.0",
"version": "2.1",
"author": "ClearCode Inc.",
"description": "__MSG_extensionDescription__",
"permissions": [
Expand Down

0 comments on commit d7ea790

Please sign in to comment.