mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-15 20:11:30 +01:00
Remove noop - openPopup and use promptForLogin instead when vault is locked
This commit is contained in:
parent
0f000731b9
commit
0e832ee435
@ -11,6 +11,7 @@ import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.serv
|
|||||||
|
|
||||||
import { EventType } from 'jslib-common/enums/eventType';
|
import { EventType } from 'jslib-common/enums/eventType';
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||||
|
import LockedVaultPendingNotificationsItem from './models/lockedVaultPendingNotificationsItem';
|
||||||
|
|
||||||
export default class ContextMenusBackground {
|
export default class ContextMenusBackground {
|
||||||
private contextMenus: any;
|
private contextMenus: any;
|
||||||
@ -58,14 +59,18 @@ export default class ContextMenusBackground {
|
|||||||
|
|
||||||
private async cipherAction(tab: chrome.tabs.Tab, info: chrome.contextMenus.OnClickData) {
|
private async cipherAction(tab: chrome.tabs.Tab, info: chrome.contextMenus.OnClickData) {
|
||||||
const id = info.menuItemId.split('_')[1];
|
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()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user