From 6268b5fe4823b6c22840e4fac959d37574596ce6 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Wed, 17 Jul 2024 21:57:47 +0300 Subject: [PATCH] refactor: Reorder code blocks for better readability Signed-off-by: Awiteb --- .../src/websocket/handlers/chat_request.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/oxidetalis/src/websocket/handlers/chat_request.rs b/crates/oxidetalis/src/websocket/handlers/chat_request.rs index e9044c9..13fca2b 100644 --- a/crates/oxidetalis/src/websocket/handlers/chat_request.rs +++ b/crates/oxidetalis/src/websocket/handlers/chat_request.rs @@ -107,18 +107,6 @@ pub async fn handle_chat_response( return Some(WsError::NoChatRequestFromRecipient.into()); } - if let Some(conn_id) = ONLINE_USERS.is_online(sender_public_key).await { - ONLINE_USERS - .send( - &conn_id, - ServerEvent::chat_request_response(recipient_public_key, accepted), - ) - .await; - } else { - // TODO: Create a table for chat request responses, and send them when - // the user logs in - } - // We don't need to handle the case where the sender is blacklisted or // whitelisted already, just add it if it is not already there let _ = if accepted { @@ -132,5 +120,17 @@ pub async fn handle_chat_response( .await ); + if let Some(conn_id) = ONLINE_USERS.is_online(sender_public_key).await { + ONLINE_USERS + .send( + &conn_id, + ServerEvent::chat_request_response(recipient_public_key, accepted), + ) + .await; + } else { + // TODO: Create a table for chat request responses, and send them when + // the user logs in + } + None }