Merge pull request #11889 from pedrobmarin/connection-status-extra

Offline users' connection status improvements
This commit is contained in:
Anton Georgiev 2021-04-05 12:30:39 -04:00 committed by GitHub
commit ea62e890a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,6 +142,12 @@ const sortLevel = (a, b) => {
if (indexOfA > indexOfB) return -1;
};
const sortOffline = (a, b) => {
if (a.offline && !b.offline) return 1;
if (a.offline === b.offline) return 0;
if (!a.offline && b.offline) return -1;
};
const getMyConnectionStatus = () => {
const myConnectionStatus = ConnectionStatus.findOne(
{
@ -175,6 +181,7 @@ const getMyConnectionStatus = () => {
return [{
name: Auth.fullname,
avatar: me.avatar,
offline: false,
you: true,
moderator: false,
color: me.color,
@ -244,7 +251,7 @@ const getConnectionStatus = () => {
}
return result;
}, []).sort(sortLevel);
}, []).sort(sortLevel).sort(sortOffline);
};
const isEnabled = () => STATS.enabled;