diff --git a/src/Core/Vault/Services/Implementations/CipherService.cs b/src/Core/Vault/Services/Implementations/CipherService.cs index 2085345b16..08b86ae87c 100644 --- a/src/Core/Vault/Services/Implementations/CipherService.cs +++ b/src/Core/Vault/Services/Implementations/CipherService.cs @@ -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]); diff --git a/test/Core.Test/Vault/Services/CipherServiceTests.cs b/test/Core.Test/Vault/Services/CipherServiceTests.cs index c5eecb8f34..b7950b92d4 100644 --- a/test/Core.Test/Vault/Services/CipherServiceTests.cs +++ b/test/Core.Test/Vault/Services/CipherServiceTests.cs @@ -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().Received(1).UpsertAsync(cipherDetails); await sutProvider.GetDependency().Received(1).LogCipherEventAsync(cipherDetails, EventType.Cipher_SoftDeleted);