feat(browser-extension): switch to warn mode after reporting an issue

This commit is contained in:
wanhose 2024-10-08 01:46:47 +02:00
parent 75825eaf14
commit 34df85f8b9
2 changed files with 9 additions and 3 deletions

View File

@ -294,7 +294,10 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
}
break;
case 'ENABLE_ICON':
if (isPage && tabId !== undefined) enableIcon(hostname, tabId);
if (isPage && tabId !== undefined) {
enableIcon(hostname, tabId).then(callback);
return true;
}
break;
case 'ENABLE_POPUP':
if (isPage && tabId !== undefined) {
@ -344,8 +347,8 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
}
break;
case 'UPDATE_STORE':
triggerStoreUpdate(hostname, message.state);
break;
triggerStoreUpdate(hostname, message.state).then(callback);
return true;
default:
break;
}

View File

@ -219,7 +219,10 @@ async function submitButtonClickHandler(event) {
const submitView = dialog?.getElementsByClassName('report-dialog-submit-view')[0];
const userAgent = window.navigator.userAgent;
const issueUrl = await dispatch({ userAgent, reason: reasonText, url: urlText, type: 'REPORT' });
const issue = { expiresIn: Date.now() + 8 * 60 * 60 * 1000, flags: ['bug'], url: issueUrl };
await dispatch({ hostname, state: { issue }, type: 'UPDATE_STORE' });
await dispatch({ hostname, type: 'ENABLE_ICON' });
formView?.setAttribute('hidden', 'true');
issueButton?.addEventListener('click', () => window.open(issueUrl, '_blank'));
submitView?.removeAttribute('hidden');