1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

Remove logic out of notification content scripts

This commit is contained in:
Daniel James Smith
2021-10-18 16:42:32 +02:00
parent fd8de4ca0c
commit 95e9387314
3 changed files with 20 additions and 27 deletions

View File

@@ -23,6 +23,7 @@ import { PolicyType } from 'jslib-common/enums/policyType';
import AddChangePasswordQueueMessage from './models/addChangePasswordQueueMessage';
import AddLoginQueueMessage from './models/addLoginQueueMessage';
import { NotificationQueueMessageType } from './models/NotificationQueueMessageType';
import lockedVaultPendingNotificationsItem from './models/lockedVaultPendingNotificationsItem';
export default class NotificationBackground {
@@ -75,6 +76,18 @@ export default class NotificationBackground {
break;
case 'bgAddSave':
case 'bgChangeSave':
if (await this.vaultTimeoutService.isLocked()) {
const retryMessage: lockedVaultPendingNotificationsItem = {
commandToRetry: {
msg: msg,
sender: sender,
},
target: 'notification.background',
};
await BrowserApi.tabSendMessageData(sender.tab, 'addToLockedVaultPendingNotifications', retryMessage);
await BrowserApi.tabSendMessageData(sender.tab, 'promptForLogin');
return;
}
await this.saveOrUpdateCredentials(sender.tab, msg.folder);
break;
case 'bgNeverSave':