mirror of
https://github.com/bitwarden/browser
synced 2026-03-02 19:41:26 +00:00
Merge branch 'main' into PM-29919-Add-dropdown-to-select-email-verification-and-emails-field-to-Send-when-creating-or-editing-a-Send
This commit is contained in:
@@ -525,6 +525,20 @@ describe("VaultExportService", () => {
|
||||
const exportedData = actual as ExportedVaultAsString;
|
||||
expectEqualFolders(UserFolders, exportedData.data);
|
||||
});
|
||||
|
||||
it("does not export the key property in unencrypted exports", async () => {
|
||||
// Create a cipher with a key property
|
||||
const cipherWithKey = generateCipherView(false);
|
||||
(cipherWithKey as any).key = "shouldBeDeleted";
|
||||
cipherService.getAllDecrypted.mockResolvedValue([cipherWithKey]);
|
||||
|
||||
const actual = await exportService.getExport(userId, "json");
|
||||
expect(typeof actual.data).toBe("string");
|
||||
const exportedData = actual as ExportedVaultAsString;
|
||||
const parsed = JSON.parse(exportedData.data);
|
||||
expect(parsed.items.length).toBe(1);
|
||||
expect(parsed.items[0].key).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
export class FolderResponse {
|
||||
|
||||
@@ -317,6 +317,7 @@ export class IndividualVaultExportService
|
||||
const cipher = new CipherWithIdExport();
|
||||
cipher.build(c);
|
||||
cipher.collectionIds = null;
|
||||
delete cipher.key;
|
||||
jsonDoc.items.push(cipher);
|
||||
});
|
||||
|
||||
|
||||
@@ -383,6 +383,7 @@ export class OrganizationVaultExportService
|
||||
decCiphers.forEach((c) => {
|
||||
const cipher = new CipherWithIdExport();
|
||||
cipher.build(c);
|
||||
delete cipher.key;
|
||||
jsonDoc.items.push(cipher);
|
||||
});
|
||||
return JSON.stringify(jsonDoc, null, " ");
|
||||
|
||||
@@ -44,8 +44,10 @@ export const SendItemDialogResult = Object.freeze({
|
||||
} as const);
|
||||
|
||||
/** A result of the Send add/edit dialog. */
|
||||
export type SendItemDialogResult = (typeof SendItemDialogResult)[keyof typeof SendItemDialogResult];
|
||||
|
||||
export type SendItemDialogResult = {
|
||||
result: (typeof SendItemDialogResult)[keyof typeof SendItemDialogResult];
|
||||
send?: SendView;
|
||||
};
|
||||
/**
|
||||
* Component for adding or editing a send item.
|
||||
*/
|
||||
@@ -93,7 +95,7 @@ export class SendAddEditDialogComponent {
|
||||
*/
|
||||
async onSendCreated(send: SendView) {
|
||||
// FIXME Add dialogService.open send-created dialog
|
||||
this.dialogRef.close(SendItemDialogResult.Saved);
|
||||
this.dialogRef.close({ result: SendItemDialogResult.Saved, send });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,14 +103,14 @@ export class SendAddEditDialogComponent {
|
||||
* Handles the event when the send is updated.
|
||||
*/
|
||||
async onSendUpdated(send: SendView) {
|
||||
this.dialogRef.close(SendItemDialogResult.Saved);
|
||||
this.dialogRef.close({ result: SendItemDialogResult.Saved });
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the event when the send is deleted.
|
||||
*/
|
||||
async onSendDeleted() {
|
||||
this.dialogRef.close(SendItemDialogResult.Deleted);
|
||||
this.dialogRef.close({ result: SendItemDialogResult.Deleted });
|
||||
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
|
||||
Reference in New Issue
Block a user