vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit 7ce06b3808fd0b45cc40d98dc3caeda699ecf1dd
parent 0bd3a260516b3bf031f577a1656cafc2c5d6c3b7
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Wed,  6 Feb 2019 17:33:03 +0100

Merge pull request #387 from mprasil/collections_edit_revision

Update revision when adding or removing cipher from collection
Diffstat:
Msrc/db/models/collection.rs | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/db/models/collection.rs b/src/db/models/collection.rs @@ -278,6 +278,7 @@ pub struct CollectionCipher { /// Database methods impl CollectionCipher { pub fn save(cipher_uuid: &str, collection_uuid: &str, conn: &DbConn) -> EmptyResult { + Self::update_users_revision(&collection_uuid, conn); diesel::replace_into(ciphers_collections::table) .values(( ciphers_collections::cipher_uuid.eq(cipher_uuid), @@ -288,6 +289,7 @@ impl CollectionCipher { } pub fn delete(cipher_uuid: &str, collection_uuid: &str, conn: &DbConn) -> EmptyResult { + Self::update_users_revision(&collection_uuid, conn); diesel::delete( ciphers_collections::table .filter(ciphers_collections::cipher_uuid.eq(cipher_uuid)) @@ -308,4 +310,10 @@ impl CollectionCipher { .execute(&**conn) .map_res("Error removing ciphers from collection") } + + pub fn update_users_revision(collection_uuid: &str, conn: &DbConn) { + if let Some(collection) = Collection::find_by_uuid(collection_uuid, conn) { + collection.update_users_revision(conn); + } + } }