Fixing online counts. Fixes #664
This commit is contained in:
parent
49892690ff
commit
1c3ed864e7
5 changed files with 23 additions and 34 deletions
|
@ -4,7 +4,7 @@ use crate::{
|
||||||
apub::ActorType,
|
apub::ActorType,
|
||||||
blocking,
|
blocking,
|
||||||
websocket::{
|
websocket::{
|
||||||
server::{JoinCommunityRoom, SendCommunityRoomMessage},
|
server::{GetCommunityUsersOnline, JoinCommunityRoom, SendCommunityRoomMessage},
|
||||||
UserOperation,
|
UserOperation,
|
||||||
WebsocketInfo,
|
WebsocketInfo,
|
||||||
},
|
},
|
||||||
|
@ -203,13 +203,10 @@ impl Perform for Oper<GetCommunity> {
|
||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
ws.chatserver
|
||||||
// TODO
|
.send(GetCommunityUsersOnline { community_id })
|
||||||
1
|
.await
|
||||||
// let fut = async {
|
.unwrap_or(1)
|
||||||
// ws.chatserver.send(GetCommunityUsersOnline {community_id}).await.unwrap()
|
|
||||||
// };
|
|
||||||
// Runtime::new().unwrap().block_on(fut)
|
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::{
|
||||||
blocking,
|
blocking,
|
||||||
fetch_iframely_and_pictrs_data,
|
fetch_iframely_and_pictrs_data,
|
||||||
websocket::{
|
websocket::{
|
||||||
server::{JoinCommunityRoom, JoinPostRoom, SendPost},
|
server::{GetPostUsersOnline, JoinCommunityRoom, JoinPostRoom, SendPost},
|
||||||
UserOperation,
|
UserOperation,
|
||||||
WebsocketInfo,
|
WebsocketInfo,
|
||||||
},
|
},
|
||||||
|
@ -306,13 +306,10 @@ impl Perform for Oper<GetPost> {
|
||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
ws.chatserver
|
||||||
// TODO
|
.send(GetPostUsersOnline { post_id: data.id })
|
||||||
1
|
.await
|
||||||
// let fut = async {
|
.unwrap_or(1)
|
||||||
// ws.chatserver.send(GetPostUsersOnline {post_id: data.id}).await.unwrap()
|
|
||||||
// };
|
|
||||||
// Runtime::new().unwrap().block_on(fut)
|
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,11 @@ use crate::{
|
||||||
apub::fetcher::search_by_apub_id,
|
apub::fetcher::search_by_apub_id,
|
||||||
blocking,
|
blocking,
|
||||||
version,
|
version,
|
||||||
websocket::{server::SendAllMessage, UserOperation, WebsocketInfo},
|
websocket::{
|
||||||
|
server::{GetUsersOnline, SendAllMessage},
|
||||||
|
UserOperation,
|
||||||
|
WebsocketInfo,
|
||||||
|
},
|
||||||
DbPool,
|
DbPool,
|
||||||
LemmyError,
|
LemmyError,
|
||||||
};
|
};
|
||||||
|
@ -409,13 +413,8 @@ impl Perform for Oper<GetSite> {
|
||||||
|
|
||||||
let banned = blocking(pool, move |conn| UserView::banned(conn)).await??;
|
let banned = blocking(pool, move |conn| UserView::banned(conn)).await??;
|
||||||
|
|
||||||
let online = if let Some(_ws) = websocket_info {
|
let online = if let Some(ws) = websocket_info {
|
||||||
// TODO
|
ws.chatserver.send(GetUsersOnline).await.unwrap_or(1)
|
||||||
1
|
|
||||||
// let fut = async {
|
|
||||||
// ws.chatserver.send(GetUsersOnline).await.unwrap()
|
|
||||||
// };
|
|
||||||
// Runtime::new().unwrap().block_on(fut)
|
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
8
ui/src/components/main.tsx
vendored
8
ui/src/components/main.tsx
vendored
|
@ -385,11 +385,9 @@ export class Main extends Component<any, MainState> {
|
||||||
badges() {
|
badges() {
|
||||||
return (
|
return (
|
||||||
<ul class="my-2 list-inline">
|
<ul class="my-2 list-inline">
|
||||||
{/*
|
<li className="list-inline-item badge badge-light">
|
||||||
<li className="list-inline-item badge badge-light">
|
{i18n.t('number_online', { count: this.state.siteRes.online })}
|
||||||
{i18n.t('number_online', { count: this.state.siteRes.online })}
|
</li>
|
||||||
</li>
|
|
||||||
*/}
|
|
||||||
<li className="list-inline-item badge badge-light">
|
<li className="list-inline-item badge badge-light">
|
||||||
{i18n.t('number_of_users', {
|
{i18n.t('number_of_users', {
|
||||||
count: this.state.siteRes.site.number_of_users,
|
count: this.state.siteRes.site.number_of_users,
|
||||||
|
|
8
ui/src/components/sidebar.tsx
vendored
8
ui/src/components/sidebar.tsx
vendored
|
@ -125,11 +125,9 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
let community = this.props.community;
|
let community = this.props.community;
|
||||||
return (
|
return (
|
||||||
<ul class="my-1 list-inline">
|
<ul class="my-1 list-inline">
|
||||||
{/*
|
<li className="list-inline-item badge badge-light">
|
||||||
<li className="list-inline-item badge badge-light">
|
{i18n.t('number_online', { count: this.props.online })}
|
||||||
{i18n.t('number_online', { count: this.props.online })}
|
</li>
|
||||||
</li>
|
|
||||||
*/}
|
|
||||||
<li className="list-inline-item badge badge-light">
|
<li className="list-inline-item badge badge-light">
|
||||||
{i18n.t('number_of_subscribers', {
|
{i18n.t('number_of_subscribers', {
|
||||||
count: community.number_of_subscribers,
|
count: community.number_of_subscribers,
|
||||||
|
|
Loading…
Reference in a new issue