1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01: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
commit 4b5e708ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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