Merge pull request #51 from wagesj45/codex/fix-bug-in-details.js-with-missing-params

Fix message ID handling in details popup
This commit is contained in:
Jordan Wages 2025-06-27 21:59:22 -05:00 committed by GitHub
commit e14587476e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,17 @@
document.addEventListener('DOMContentLoaded', async () => {
const params = new URLSearchParams(location.search);
const id = parseInt(params.get('mid'), 10);
let id = parseInt(params.get('mid'), 10);
if (!id) {
try {
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
const tabId = tabs[0]?.id;
const msgs = tabId ? await browser.messageDisplay.getDisplayedMessages(tabId) : [];
id = msgs[0]?.id;
} catch (e) {
console.error('failed to determine message id', e);
}
}
if (!id) return;
try {
const { subject, results } = await browser.runtime.sendMessage({ type: 'sortana:getDetails', id });