From 4bf32af60e7687c4e13650d2b232679817cefde7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 15 Jan 2019 15:28:25 +0100 Subject: [PATCH] Fix folder notifications, enable template strict mode and add missing option to env template --- .env.template | 3 +++ src/api/core/ciphers.rs | 5 +++-- src/main.rs | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index bb26963..ea3516b 100644 --- a/.env.template +++ b/.env.template @@ -23,6 +23,9 @@ # WEB_VAULT_FOLDER=web-vault/ # WEB_VAULT_ENABLED=true +## Enables websocket notifications +# WEBSOCKET_ENABLED=false + ## Controls the WebSocket server address and port # WEBSOCKET_ADDRESS=0.0.0.0 # WEBSOCKET_PORT=3012 diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index de75a98..c393b61 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -299,11 +299,12 @@ pub fn update_cipher_from_data( cipher.data = type_data.to_string(); cipher.password_history = data.PasswordHistory.map(|f| f.to_string()); + cipher.move_to_folder(data.FolderId, &headers.user.uuid, &conn)?; cipher.save(&conn)?; nt.send_cipher_update(ut, &cipher, &cipher.update_users_revision(&conn)); - cipher.move_to_folder(data.FolderId, &headers.user.uuid, &conn) + Ok(()) } use super::folders::FolderData; @@ -884,7 +885,7 @@ fn delete_all(data: JsonUpcase, headers: Headers, conn: DbConn, nt // Delete folders for f in Folder::find_by_user(&user.uuid, &conn) { f.delete(&conn)?; - nt.send_folder_update(UpdateType::FolderCreate, &f); + nt.send_folder_update(UpdateType::FolderDelete, &f); } Ok(()) diff --git a/src/main.rs b/src/main.rs index c440ef4..619558e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -334,6 +334,8 @@ pub struct Config { fn load_templates(path: String) -> Handlebars { let mut hb = Handlebars::new(); + // Error on missing params + hb.set_strict_mode(true); macro_rules! reg { ($name:expr) => {