1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-16 04:12:53 +01:00

Update user revision date with sends

Dieser Commit ist enthalten in:
Daniel García 2021-03-22 19:05:15 +01:00
Ursprung 551810c486
Commit 46a1a013cd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A

Datei anzeigen

@ -157,7 +157,7 @@ use crate::error::MapResult;
impl Send { impl Send {
pub fn save(&mut self, conn: &DbConn) -> EmptyResult { 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(); self.revision_date = Utc::now().naive_utc();
db_run! { conn: db_run! { conn:
@ -192,7 +192,7 @@ impl Send {
} }
pub fn delete(&self, conn: &DbConn) -> EmptyResult { pub fn delete(&self, conn: &DbConn) -> EmptyResult {
// self.update_users_revision(conn); self.update_users_revision(conn);
db_run! { conn: { db_run! { conn: {
diesel::delete(sends::table.filter(sends::uuid.eq(&self.uuid))) 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 { pub fn delete_all_by_user(user_uuid: &str, conn: &DbConn) -> EmptyResult {
for send in Self::find_by_user(user_uuid, &conn) { for send in Self::find_by_user(user_uuid, &conn) {
send.delete(&conn)?; send.delete(&conn)?;