1
0
mirror of https://github.com/bitwarden/server synced 2025-12-23 19:53:40 +00:00

Merge pull request #693 from bitwarden/soft-delete-fix

[Soft Delete] - fix Upsert calls based on cipher supertype
This commit is contained in:
Chad Scharf
2020-04-09 09:22:13 -04:00
committed by GitHub

View File

@@ -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