From c0bcdf46376a30b923ef2aff116a87a9d4813e31 Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Mon, 11 Jul 2022 11:03:44 -0400 Subject: [PATCH] Get full cipher details when update cipher notification is received (#3063) --- libs/common/src/abstractions/api.service.ts | 1 + libs/common/src/services/api.service.ts | 5 +++++ libs/common/src/services/sync.service.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/common/src/abstractions/api.service.ts b/libs/common/src/abstractions/api.service.ts index 8405c53366..24517be522 100644 --- a/libs/common/src/abstractions/api.service.ts +++ b/libs/common/src/abstractions/api.service.ts @@ -262,6 +262,7 @@ export abstract class ApiService { renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise; getCipher: (id: string) => Promise; + getFullCipherDetails: (id: string) => Promise; getCipherAdmin: (id: string) => Promise; getAttachmentData: ( cipherId: string, diff --git a/libs/common/src/services/api.service.ts b/libs/common/src/services/api.service.ts index 7cf4964caf..ab41555d9c 100644 --- a/libs/common/src/services/api.service.ts +++ b/libs/common/src/services/api.service.ts @@ -589,6 +589,11 @@ export class ApiService implements ApiServiceAbstraction { return new CipherResponse(r); } + async getFullCipherDetails(id: string): Promise { + const r = await this.send("GET", "/ciphers/" + id + "/details", null, true, true); + return new CipherResponse(r); + } + async getCipherAdmin(id: string): Promise { const r = await this.send("GET", "/ciphers/" + id + "/admin", null, true, true); return new CipherResponse(r); diff --git a/libs/common/src/services/sync.service.ts b/libs/common/src/services/sync.service.ts index 8a061bcbb1..b96ff24d39 100644 --- a/libs/common/src/services/sync.service.ts +++ b/libs/common/src/services/sync.service.ts @@ -198,7 +198,7 @@ export class SyncService implements SyncServiceAbstraction { } if (shouldUpdate) { - const remoteCipher = await this.apiService.getCipher(notification.id); + const remoteCipher = await this.apiService.getFullCipherDetails(notification.id); if (remoteCipher != null) { await this.cipherService.upsert(new CipherData(remoteCipher)); this.messagingService.send("syncedUpsertedCipher", { cipherId: notification.id });