From 4defd133959c52eeac88dedf042cc8d925a4d87c Mon Sep 17 00:00:00 2001 From: Chad Scharf <3904944+cscharf@users.noreply.github.com> Date: Wed, 8 Apr 2020 16:18:22 -0400 Subject: [PATCH] [Soft Delete] - fix Upsert calls based on cipher supertype --- .../Services/Implementations/CipherService.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Core/Services/Implementations/CipherService.cs b/src/Core/Services/Implementations/CipherService.cs index e858bb62b..d04425e42 100644 --- a/src/Core/Services/Implementations/CipherService.cs +++ b/src/Core/Services/Implementations/CipherService.cs @@ -679,7 +679,14 @@ namespace Bit.Core.Services cipher.DeletedDate = cipher.RevisionDate = DateTime.UtcNow; - await _cipherRepository.UpsertAsync(cipher); + if (cipher is CipherDetails details) + { + await _cipherRepository.UpsertAsync(details); + } + else + { + await _cipherRepository.UpsertAsync(cipher); + } await _eventService.LogCipherEventAsync(cipher, EventType.Cipher_SoftDeleted); // push @@ -721,7 +728,14 @@ namespace Bit.Core.Services cipher.DeletedDate = null; cipher.RevisionDate = DateTime.UtcNow; - await _cipherRepository.UpsertAsync(cipher); + if (cipher is CipherDetails details) + { + await _cipherRepository.UpsertAsync(details); + } + else + { + await _cipherRepository.UpsertAsync(cipher); + } await _eventService.LogCipherEventAsync(cipher, EventType.Cipher_Restored); // push