mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 11:43:46 +00:00
[PM-22734] Patch the cipher form after attachments are modified on Desktop (#15227)
(cherry picked from commit a659c0a32d)
This commit is contained in:
@@ -61,6 +61,7 @@ import {
|
|||||||
DefaultChangeLoginPasswordService,
|
DefaultChangeLoginPasswordService,
|
||||||
DefaultCipherFormConfigService,
|
DefaultCipherFormConfigService,
|
||||||
PasswordRepromptService,
|
PasswordRepromptService,
|
||||||
|
CipherFormComponent,
|
||||||
} from "@bitwarden/vault";
|
} from "@bitwarden/vault";
|
||||||
|
|
||||||
import { NavComponent } from "../../../app/layout/nav.component";
|
import { NavComponent } from "../../../app/layout/nav.component";
|
||||||
@@ -119,6 +120,8 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||||||
vaultFilterComponent: VaultFilterComponent | null = null;
|
vaultFilterComponent: VaultFilterComponent | null = null;
|
||||||
@ViewChild("folderAddEdit", { read: ViewContainerRef, static: true })
|
@ViewChild("folderAddEdit", { read: ViewContainerRef, static: true })
|
||||||
folderAddEditModalRef: ViewContainerRef | null = null;
|
folderAddEditModalRef: ViewContainerRef | null = null;
|
||||||
|
@ViewChild(CipherFormComponent)
|
||||||
|
cipherFormComponent: CipherFormComponent | null = null;
|
||||||
|
|
||||||
action: CipherFormMode | "view" | null = null;
|
action: CipherFormMode | "view" | null = null;
|
||||||
cipherId: string | null = null;
|
cipherId: string | null = null;
|
||||||
@@ -388,6 +391,26 @@ export class VaultV2Component implements OnInit, OnDestroy {
|
|||||||
result?.action === AttachmentDialogResult.Uploaded
|
result?.action === AttachmentDialogResult.Uploaded
|
||||||
) {
|
) {
|
||||||
await this.vaultItemsComponent?.refresh().catch(() => {});
|
await this.vaultItemsComponent?.refresh().catch(() => {});
|
||||||
|
|
||||||
|
if (this.cipherFormComponent == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const updatedCipher = await this.cipherService.get(
|
||||||
|
this.cipherId as CipherId,
|
||||||
|
this.activeUserId as UserId,
|
||||||
|
);
|
||||||
|
const updatedCipherView = await this.cipherService.decrypt(
|
||||||
|
updatedCipher,
|
||||||
|
this.activeUserId as UserId,
|
||||||
|
);
|
||||||
|
|
||||||
|
this.cipherFormComponent.patchCipher((currentCipher) => {
|
||||||
|
currentCipher.attachments = updatedCipherView.attachments;
|
||||||
|
currentCipher.revisionDate = updatedCipherView.revisionDate;
|
||||||
|
|
||||||
|
return currentCipher;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user