1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +00:00

[PM-12759] - Admin Console - Link to vault cipher is not opening cipher modal (#12738)

* fix initial load emission race

* prevent double dialog render

* put logic back in place
This commit is contained in:
Jordan Aasen
2025-01-10 10:00:57 -08:00
committed by GitHub
parent 2a30c27d18
commit b8f57f3464

View File

@@ -32,7 +32,6 @@ import {
switchMap, switchMap,
takeUntil, takeUntil,
tap, tap,
withLatestFrom,
} from "rxjs/operators"; } from "rxjs/operators";
import { import {
@@ -194,6 +193,7 @@ export class VaultComponent implements OnInit, OnDestroy {
protected currentSearchText$: Observable<string>; protected currentSearchText$: Observable<string>;
protected freeTrial$: Observable<FreeTrial>; protected freeTrial$: Observable<FreeTrial>;
protected resellerWarning$: Observable<ResellerWarning | null>; protected resellerWarning$: Observable<ResellerWarning | null>;
protected prevCipherId: string | null = null;
/** /**
* A list of collections that the user can assign items to and edit those items within. * A list of collections that the user can assign items to and edit those items within.
* @protected * @protected
@@ -538,25 +538,26 @@ export class VaultComponent implements OnInit, OnDestroy {
firstSetup$ firstSetup$
.pipe( .pipe(
switchMap(() => this.route.queryParams), switchMap(() => combineLatest([this.route.queryParams, allCipherMap$])),
// Only process the queryParams if the dialog is not open (only when extension refresh is enabled)
filter(() => this.vaultItemDialogRef == undefined || !this.extensionRefreshEnabled), filter(() => this.vaultItemDialogRef == undefined || !this.extensionRefreshEnabled),
withLatestFrom(allCipherMap$, allCollections$, organization$),
switchMap(async ([qParams, allCiphersMap]) => { switchMap(async ([qParams, allCiphersMap]) => {
const cipherId = getCipherIdFromParams(qParams); const cipherId = getCipherIdFromParams(qParams);
if (!cipherId) { if (!cipherId) {
this.prevCipherId = null;
return; return;
} }
const cipher = allCiphersMap[cipherId];
if (cipherId === this.prevCipherId) {
return;
}
this.prevCipherId = cipherId;
const cipher = allCiphersMap[cipherId];
if (cipher) { if (cipher) {
let action = qParams.action; let action = qParams.action;
// Default to "view" if extension refresh is enabled
if (action == null && this.extensionRefreshEnabled) {
action = "view";
}
if (action == "showFailedToDecrypt") { if (action == "showFailedToDecrypt") {
DecryptionFailureDialogComponent.open(this.dialogService, { DecryptionFailureDialogComponent.open(this.dialogService, {
cipherIds: [cipherId as CipherId], cipherIds: [cipherId as CipherId],
@@ -569,6 +570,11 @@ export class VaultComponent implements OnInit, OnDestroy {
return; return;
} }
// Default to "view" if extension refresh is enabled
if (action == null && this.extensionRefreshEnabled) {
action = "view";
}
if (action === "view") { if (action === "view") {
await this.viewCipherById(cipher); await this.viewCipherById(cipher);
} else { } else {