1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

[Soft Delete] - fix Upsert calls based on cipher supertype

This commit is contained in:
Chad Scharf 2020-04-08 16:18:22 -04:00
parent b106fd22fb
commit 4defd13395

View File

@ -679,7 +679,14 @@ namespace Bit.Core.Services
cipher.DeletedDate = cipher.RevisionDate = DateTime.UtcNow;
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;
if (cipher is CipherDetails details)
{
await _cipherRepository.UpsertAsync(details);
}
else
{
await _cipherRepository.UpsertAsync(cipher);
}
await _eventService.LogCipherEventAsync(cipher, EventType.Cipher_Restored);
// push