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 46a1a013cd471c473964a7113dc2fab497732cc4
parent 551810c4862506ed39780850a35ac12df1aca1a9
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Mon, 22 Mar 2021 19:05:15 +0100

Update user revision date with sends

Diffstat:
Msrc/db/models/send.rs | 17++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/db/models/send.rs b/src/db/models/send.rs @@ -75,7 +75,7 @@ impl Send { disabled: false, } } - + pub fn set_password(&mut self, password: Option<&str>) { const PASSWORD_ITER: i32 = 100_000; @@ -157,7 +157,7 @@ use crate::error::MapResult; impl Send { pub fn save(&mut self, conn: &DbConn) -> EmptyResult { - // self.update_users_revision(conn); + self.update_users_revision(conn); self.revision_date = Utc::now().naive_utc(); db_run! { conn: @@ -192,7 +192,7 @@ impl Send { } pub fn delete(&self, conn: &DbConn) -> EmptyResult { - // self.update_users_revision(conn); + self.update_users_revision(conn); db_run! { conn: { diesel::delete(sends::table.filter(sends::uuid.eq(&self.uuid))) @@ -201,6 +201,17 @@ impl Send { }} } + pub fn update_users_revision(&self, conn: &DbConn) { + match self.user_uuid { + Some(user_uuid) => { + User::update_uuid_revision(&user_uuid, conn); + } + None => { + // Belongs to Organization, not implemented + } + } + } + pub fn delete_all_by_user(user_uuid: &str, conn: &DbConn) -> EmptyResult { for send in Self::find_by_user(user_uuid, &conn) { send.delete(&conn)?;