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

update the cipher revision date when an attachment is added or deleted

This commit is contained in:
Nick Krantz 2024-10-09 13:12:31 -05:00
parent d93524030c
commit d9d313e498
No known key found for this signature in database
GPG Key ID: FF670021ABCAB82E

View File

@ -210,6 +210,10 @@ public class CipherService : ICipherService
AttachmentData = JsonSerializer.Serialize(data) AttachmentData = JsonSerializer.Serialize(data)
}); });
cipher.AddAttachment(attachmentId, data); cipher.AddAttachment(attachmentId, data);
// Update the revision date when an attachment is added
cipher.RevisionDate = DateTime.UtcNow;
await _pushService.PushSyncCipherUpdateAsync(cipher, null); await _pushService.PushSyncCipherUpdateAsync(cipher, null);
return (attachmentId, uploadUrl); return (attachmentId, uploadUrl);
@ -259,6 +263,9 @@ public class CipherService : ICipherService
throw; throw;
} }
// Update the revision date when an attachment is added
cipher.RevisionDate = DateTime.UtcNow;
// push // push
await _pushService.PushSyncCipherUpdateAsync(cipher, null); await _pushService.PushSyncCipherUpdateAsync(cipher, null);
} }
@ -1021,6 +1028,9 @@ public class CipherService : ICipherService
await _attachmentStorageService.DeleteAttachmentAsync(cipher.Id, attachmentData); await _attachmentStorageService.DeleteAttachmentAsync(cipher.Id, attachmentData);
await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_AttachmentDeleted); await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_AttachmentDeleted);
// Update the revision date when an attachment is deleted
cipher.RevisionDate = DateTime.UtcNow;
// push // push
await _pushService.PushSyncCipherUpdateAsync(cipher, null); await _pushService.PushSyncCipherUpdateAsync(cipher, null);
} }