From 5f3eab7c07ab9f1fb32c879ef1064be320766509 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 5 Feb 2021 13:29:44 +0100 Subject: [PATCH] Close user websockets when deleting its account --- src/helpers/account_helper.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/helpers/account_helper.rs b/src/helpers/account_helper.rs index 21c2bfa..b35c869 100644 --- a/src/helpers/account_helper.rs +++ b/src/helpers/account_helper.rs @@ -1,5 +1,6 @@ use crate::constants::{PASSWORD_RESET_TOKEN_LENGTH, PASSWORD_RESET_TOKEN_LIFETIME}; use crate::constants::database_tables_names::{USER_ACCESS_TOKENS_TABLE, USERS_TABLE}; +use crate::controllers::user_ws_controller; use crate::data::account_export::AccountExport; use crate::data::api_client::APIClient; use crate::data::error::{ExecError, ResultBoxError}; @@ -302,7 +303,8 @@ pub fn export(user_id: &UserID) -> ResultBoxError { /// Delete a user's account pub fn delete(user_id: &UserID) -> ResultBoxError { - // TODO : close all websockets of user + // Close all WebSockets of user + user_ws_controller::disconnect_user_from_all_sockets(user_id)?; // Delete all group membership groups_helper::delete_all_user_groups(user_id)?;