From 3b5bebab7893d4d2d68ff6de4a43a542d3b91be2 Mon Sep 17 00:00:00 2001 From: heikkari Date: Mon, 16 Aug 2021 01:05:54 +0300 Subject: [PATCH] Fix: User's invisibility status is exposed --- src/notifications/websocket.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/notifications/websocket.rs b/src/notifications/websocket.rs index 65429239..64373cee 100644 --- a/src/notifications/websocket.rs +++ b/src/notifications/websocket.rs @@ -116,7 +116,13 @@ async fn accept(stream: TcpStream) { } } { if let Ok(user) = (Ref { id: id.clone() }).fetch_user().await { + let is_invisible = if let Some(status) = user.status { + if let Some(presence) = status.presence { + presence == Presence::Invisible + } + }; let was_online = is_online(&id); + { match USERS.write() { Ok(mut map) => { @@ -152,7 +158,7 @@ async fn accept(stream: TcpStream) { Ok(payload) => { send(payload); - if !was_online { + if !was_online && !is_invisible { ClientboundNotification::UserUpdate { id: id.clone(), data: json!({