Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude federated and app users from active user count #16489

Merged
merged 3 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/models/server/models/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ export class Users extends Base {
return this.find({
active: true,
type: { $nin: ['app'] },
emails: { $exists: true },
}, options);
}

Expand Down
7 changes: 4 additions & 3 deletions app/statistics/server/lib/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ export const statistics = {
}

// User statistics
statistics.totalUsers = Meteor.users.find().count();
statistics.activeUsers = Meteor.users.find({ active: true }).count();
statistics.nonActiveUsers = statistics.totalUsers - statistics.activeUsers;
statistics.totalUsers = Users.find().count();
statistics.activeUsers = Users.getActiveLocalUserCount();
Copy link
Contributor

@geekgonecrazy geekgonecrazy Feb 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so it excludes remote and app users right?

Can we add app users like we have with federated users below? Would be probably useful to know how many app users specifically like we have with remote users

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we should add the count of app users

statistics.nonActiveUsers = Users.find({ active: false }).count();
statistics.appUsers = Users.find({ type: 'app' }).count();
statistics.onlineUsers = Meteor.users.find({ statusConnection: 'online' }).count();
statistics.awayUsers = Meteor.users.find({ statusConnection: 'away' }).count();
statistics.totalConnectedUsers = statistics.onlineUsers + statistics.awayUsers;
Expand Down
1 change: 1 addition & 0 deletions client/components/admin/info/UsageSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function UsageSection({ statistics, isLoading }) {
<DescriptionList data-qa='usage-list'>
<DescriptionList.Entry label={t('Stats_Total_Users')}>{s(() => statistics.totalUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Active_Users')}>{s(() => statistics.activeUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_App_Users')}>{s(() => statistics.appUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Non_Active_Users')}>{s(() => statistics.nonActiveUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Total_Connected_Users')}>{s(() => statistics.totalConnectedUsers)}</DescriptionList.Entry>
<DescriptionList.Entry label={t('Stats_Online_Users')}>{s(() => statistics.onlineUsers)}</DescriptionList.Entry>
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -3047,6 +3047,7 @@
"Statistics_reporting": "Send Statistics to Rocket.Chat",
"Statistics_reporting_Description": "By sending your statistics, you'll help us identify how many instances of Rocket.Chat are deployed, as well as how good the system is behaving, so we can further improve it. Don't worry, as no user information is sent and all the information we receive is kept confidential.",
"Stats_Active_Users": "Activated Users",
"Stats_App_Users": "Rocket.Chat App Users",
"Stats_Avg_Channel_Users": "Average Channel Users",
"Stats_Avg_Private_Group_Users": "Average Private Group Users",
"Stats_Away_Users": "Away Users",
Expand Down Expand Up @@ -3606,4 +3607,4 @@
"Your_server_link": "Your server link",
"Your_temporary_password_is_password": "Your temporary password is <strong>[password]</strong>.",
"Your_workspace_is_ready": "Your workspace is ready to use 🎉"
}
}
3 changes: 2 additions & 1 deletion packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,7 @@
"Statistics_reporting": "Enviar estatísticas para Rocket.Chat",
"Statistics_reporting_Description": "Ao enviar suas estatísticas, você vai nos ajudar a identificar quantas instâncias de Rocket.Chat são implantadas, bem como o quão bom o sistema está se comportando, para que possamos melhorar ainda mais isso. Não se preocupe, pois nenhuma informação de usuário é enviado e toda a informação que recebemos é mantida em sigilo.",
"Stats_Active_Users": "Usuários Ativos",
"Stats_App_Users": "Usuários de Rocket.Chat App",
"Stats_Avg_Channel_Users": "Média de Usuários por Canal",
"Stats_Avg_Private_Group_Users": "Média de Usuários por Grupo Privado",
"Stats_Away_Users": "Usuários ausentes",
Expand Down Expand Up @@ -3308,4 +3309,4 @@
"Your_question": "A sua pergunta",
"Your_server_link": "O link do seu servidor",
"Your_workspace_is_ready": "O seu espaço de trabalho está pronto a usar 🎉"
}
}