forked from jmug/stoatchat
Fix: User's invisibility status is exposed
This commit is contained in:
@@ -116,7 +116,13 @@ async fn accept(stream: TcpStream) {
|
|||||||
}
|
}
|
||||||
} {
|
} {
|
||||||
if let Ok(user) = (Ref { id: id.clone() }).fetch_user().await {
|
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);
|
let was_online = is_online(&id);
|
||||||
|
|
||||||
{
|
{
|
||||||
match USERS.write() {
|
match USERS.write() {
|
||||||
Ok(mut map) => {
|
Ok(mut map) => {
|
||||||
@@ -152,7 +158,7 @@ async fn accept(stream: TcpStream) {
|
|||||||
Ok(payload) => {
|
Ok(payload) => {
|
||||||
send(payload);
|
send(payload);
|
||||||
|
|
||||||
if !was_online {
|
if !was_online && !is_invisible {
|
||||||
ClientboundNotification::UserUpdate {
|
ClientboundNotification::UserUpdate {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
data: json!({
|
data: json!({
|
||||||
|
|||||||
Reference in New Issue
Block a user