mirror of
https://github.com/bitwarden/server
synced 2025-12-15 07:43:54 +00:00
update cipher service and tests
This commit is contained in:
@@ -723,6 +723,7 @@ public class CipherService : ICipherService
|
||||
// If the cipher was archived, clear the archived date when soft deleting
|
||||
// If a user were to restore an archived cipher, it should go back to the vault not the archive vault
|
||||
cipherDetails.ArchivedDate = null;
|
||||
cipherDetails.Archives = null;
|
||||
}
|
||||
|
||||
await _securityTaskRepository.MarkAsCompleteByCipherIds([cipherDetails.Id]);
|
||||
|
||||
@@ -1829,6 +1829,8 @@ public class CipherServiceTests
|
||||
await sutProvider.Sut.SoftDeleteAsync(cipherDetails, deletingUserId);
|
||||
|
||||
Assert.NotNull(cipherDetails.DeletedDate);
|
||||
// Archives should be cleared on soft delete
|
||||
Assert.Null(cipherDetails.Archives);
|
||||
Assert.Equal(cipherDetails.RevisionDate, cipherDetails.DeletedDate);
|
||||
await sutProvider.GetDependency<ICipherRepository>().Received(1).UpsertAsync(cipherDetails);
|
||||
await sutProvider.GetDependency<IEventService>().Received(1).LogCipherEventAsync(cipherDetails, EventType.Cipher_SoftDeleted);
|
||||
|
||||
Reference in New Issue
Block a user