summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/features/open-all-notifications.tsx6
-rw-r--r--source/helpers/open-tabs.ts10
2 files changed, 9 insertions, 7 deletions
diff --git a/source/features/open-all-notifications.tsx b/source/features/open-all-notifications.tsx
index 8d4cfecf..b6af66b8 100644
--- a/source/features/open-all-notifications.tsx
+++ b/source/features/open-all-notifications.tsx
@@ -8,8 +8,6 @@ import delegate, {DelegateEvent} from 'delegate-it';
import features from '../feature-manager.js';
import openTabs from '../helpers/open-tabs.js';
import {appendBefore} from '../helpers/dom-utils.js';
-import showToast from '../github-helpers/toast.js';
-import pluralize from '../helpers/pluralize.js';
import observe from '../helpers/selector-observer.js';
// Selector works on:
@@ -32,10 +30,6 @@ async function openNotifications(notifications: Element[], markAsDone = false):
}
const openingTabs = openTabs(urls);
- await showToast(openingTabs, {
- message: 'Opening tabs…',
- doneMessage: pluralize(urls.length, '$$ tab') + ' opened',
- });
if (!await openingTabs) {
return;
}
diff --git a/source/helpers/open-tabs.ts b/source/helpers/open-tabs.ts
index 86b44884..78619cdf 100644
--- a/source/helpers/open-tabs.ts
+++ b/source/helpers/open-tabs.ts
@@ -1,11 +1,19 @@
+import showToast from '../github-helpers/toast.js';
+import pluralize from '../helpers/pluralize.js';
+
export default async function openTabs(urls: string[]): Promise<boolean> {
if (urls.length >= 10 && !confirm(`This will open ${urls.length} new tabs. Continue?`)) {
return false;
}
- await browser.runtime.sendMessage({
+ const response = browser.runtime.sendMessage({
openUrls: urls,
});
+ await showToast(response, {
+ message: 'Opening…',
+ doneMessage: pluralize(urls.length, '$$ tab') + ' opened',
+ });
+
return true;
}