1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-19 11:15:21 +01:00

Remove noop - openPopup and use promptForLogin instead when vault is locked

This commit is contained in:
Daniel James Smith 2021-10-19 16:08:40 +02:00
parent 0f000731b9
commit 0e832ee435
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726

View File

@ -11,6 +11,7 @@ import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.serv
import { EventType } from 'jslib-common/enums/eventType';
import { CipherView } from 'jslib-common/models/view/cipherView';
import LockedVaultPendingNotificationsItem from './models/lockedVaultPendingNotificationsItem';
export default class ContextMenusBackground {
private contextMenus: any;
@ -58,14 +59,18 @@ export default class ContextMenusBackground {
private async cipherAction(tab: chrome.tabs.Tab, info: chrome.contextMenus.OnClickData) {
const id = info.menuItemId.split('_')[1];
if (id === 'noop') {
if (chrome.browserAction && (chrome.browserAction as any).openPopup) {
(chrome.browserAction as any).openPopup();
}
return;
}
if (await this.vaultTimeoutService.isLocked()) {
const retryMessage: LockedVaultPendingNotificationsItem = {
commandToRetry: {
msg: { command: 'noop', data: info },
sender: { tab: tab },
},
target: 'contextmenus.background',
};
await BrowserApi.tabSendMessageData(tab, 'addToLockedVaultPendingNotifications', retryMessage);
BrowserApi.tabSendMessageData(tab, 'promptForLogin');
return;
}