1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[PM-15533] Remove isNotClone parameter from updateWithServer method (#12233)

This commit is contained in:
Shane Melton
2024-12-03 15:43:09 -08:00
committed by GitHub
parent f8c4b8afe8
commit a6c905cc1a
4 changed files with 6 additions and 12 deletions

View File

@@ -229,11 +229,11 @@ describe("Cipher Service", () => {
});
describe("updateWithServer()", () => {
it("should call apiService.putCipherAdmin when orgAdmin and isNotClone params are true", async () => {
it("should call apiService.putCipherAdmin when orgAdmin param is true", async () => {
const spy = jest
.spyOn(apiService, "putCipherAdmin")
.mockImplementation(() => Promise.resolve<any>(cipherObj.toCipherData()));
await cipherService.updateWithServer(cipherObj, true, true);
await cipherService.updateWithServer(cipherObj, true);
const expectedObj = new CipherRequest(cipherObj);
expect(spy).toHaveBeenCalled();
@@ -252,7 +252,7 @@ describe("Cipher Service", () => {
expect(spy).toHaveBeenCalledWith(cipherObj.id, expectedObj);
});
it("should call apiService.putPartialCipher when orgAdmin, isNotClone, and edit are false", async () => {
it("should call apiService.putPartialCipher when orgAdmin, and edit are false", async () => {
cipherObj.edit = false;
const spy = jest
.spyOn(apiService, "putPartialCipher")

View File

@@ -709,13 +709,9 @@ export class CipherService implements CipherServiceAbstraction {
return new Cipher(updated[cipher.id as CipherId]);
}
async updateWithServer(
cipher: Cipher,
orgAdmin?: boolean,
isNotClone?: boolean,
): Promise<Cipher> {
async updateWithServer(cipher: Cipher, orgAdmin?: boolean): Promise<Cipher> {
let response: CipherResponse;
if (orgAdmin && isNotClone) {
if (orgAdmin) {
const request = new CipherRequest(cipher);
response = await this.apiService.putCipherAdmin(cipher.id, request);
const data = new CipherData(response, cipher.collectionIds);