mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
[PM-5468] Ensure prototypes available on memory stored objects (#7399)
* Hide account switcher in addEdit generator * Handle AddEditCipher deserialization * Opaque types are not serializable * Better handle jsonification of login uris * Ensure we don't overwrite original with clone * Ensure cipherView prototype is always restored if it exists
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Jsonify } from "type-fest";
|
||||
|
||||
import { View } from "../../../models/view/view";
|
||||
import { InitializerMetadata } from "../../../platform/interfaces/initializer-metadata.interface";
|
||||
import { InitializerKey } from "../../../platform/services/cryptography/initializer-key";
|
||||
import { DeepJsonify } from "../../../types/deep-jsonify";
|
||||
import { LinkedIdType } from "../../enums";
|
||||
import { CipherRepromptType } from "../../enums/cipher-reprompt-type";
|
||||
import { CipherType } from "../../enums/cipher-type";
|
||||
@@ -141,7 +140,16 @@ export class CipherView implements View, InitializerMetadata {
|
||||
return this.linkedFieldOptions.get(id)?.i18nKey;
|
||||
}
|
||||
|
||||
static fromJSON(obj: Partial<Jsonify<CipherView>>): CipherView {
|
||||
// This is used as a marker to indicate that the cipher view object still has its prototype
|
||||
toJSON() {
|
||||
return this;
|
||||
}
|
||||
|
||||
static fromJSON(obj: Partial<DeepJsonify<CipherView>>): CipherView {
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const view = new CipherView();
|
||||
const revisionDate = obj.revisionDate == null ? null : new Date(obj.revisionDate);
|
||||
const deletedDate = obj.deletedDate == null ? null : new Date(obj.deletedDate);
|
||||
|
||||
Reference in New Issue
Block a user