refactor: Reorder code blocks for better readability

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-07-17 21:57:47 +03:00
parent 92492288c0
commit 6268b5fe48
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F

View file

@ -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
}