diff --git a/server/src/api/community.rs b/server/src/api/community.rs index 3aebb9ee9..8418e612c 100644 --- a/server/src/api/community.rs +++ b/server/src/api/community.rs @@ -4,7 +4,7 @@ use crate::{ apub::ActorType, blocking, websocket::{ - server::{JoinCommunityRoom, SendCommunityRoomMessage}, + server::{GetCommunityUsersOnline, JoinCommunityRoom, SendCommunityRoomMessage}, UserOperation, WebsocketInfo, }, @@ -205,13 +205,10 @@ impl Perform for GetCommunity { id, }); } - - // TODO - 1 - // let fut = async { - // ws.chatserver.send(GetCommunityUsersOnline {community_id}).await.unwrap() - // }; - // Runtime::new().unwrap().block_on(fut) + ws.chatserver + .send(GetCommunityUsersOnline { community_id }) + .await + .unwrap_or(1) } else { 0 }; diff --git a/server/src/api/post.rs b/server/src/api/post.rs index 2141cc10d..2b48de7a4 100644 --- a/server/src/api/post.rs +++ b/server/src/api/post.rs @@ -13,7 +13,7 @@ use crate::{ blocking, fetch_iframely_and_pictrs_data, websocket::{ - server::{JoinCommunityRoom, JoinPostRoom, SendPost}, + server::{GetPostUsersOnline, JoinCommunityRoom, JoinPostRoom, SendPost}, UserOperation, WebsocketInfo, }, @@ -308,13 +308,10 @@ impl Perform for GetPost { id, }); } - - // TODO - 1 - // let fut = async { - // ws.chatserver.send(GetPostUsersOnline {post_id: data.id}).await.unwrap() - // }; - // Runtime::new().unwrap().block_on(fut) + ws.chatserver + .send(GetPostUsersOnline { post_id: data.id }) + .await + .unwrap_or(1) } else { 0 }; diff --git a/server/src/api/site.rs b/server/src/api/site.rs index 7bf14d3a7..7800b1b1b 100644 --- a/server/src/api/site.rs +++ b/server/src/api/site.rs @@ -12,7 +12,11 @@ use crate::{ apub::fetcher::search_by_apub_id, blocking, version, - websocket::{server::SendAllMessage, UserOperation, WebsocketInfo}, + websocket::{ + server::{GetUsersOnline, SendAllMessage}, + UserOperation, + WebsocketInfo, + }, DbPool, LemmyError, }; @@ -414,13 +418,8 @@ impl Perform for GetSite { let banned = blocking(pool, move |conn| UserView::banned(conn)).await??; - let online = if let Some(_ws) = websocket_info { - // TODO - 1 - // let fut = async { - // ws.chatserver.send(GetUsersOnline).await.unwrap() - // }; - // Runtime::new().unwrap().block_on(fut) + let online = if let Some(ws) = websocket_info { + ws.chatserver.send(GetUsersOnline).await.unwrap_or(1) } else { 0 }; diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 246db6746..3c303104a 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -385,11 +385,9 @@ export class Main extends Component { badges() { return (