mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
fix user presence graph
if nobody's using your forum at all, this thing stopped working altogether
This commit is contained in:
@@ -238,6 +238,12 @@ define('admin/general/dashboard', ['semver'], function(semver) {
|
||||
color: "#949FB1",
|
||||
highlight: "#A8B3C5",
|
||||
label: "Recent/Unread"
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
color: "#4D5360",
|
||||
highlight: "#A8B3C5",
|
||||
label: "Other"
|
||||
}
|
||||
], {
|
||||
responsive: true
|
||||
@@ -311,6 +317,7 @@ define('admin/general/dashboard', ['semver'], function(semver) {
|
||||
graphs.presence.segments[1].value = users.topics;
|
||||
graphs.presence.segments[2].value = users.category;
|
||||
graphs.presence.segments[3].value = users.recent;
|
||||
graphs.presence.segments[4].value = users.other;
|
||||
|
||||
graphs.presence.update();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,8 @@ SocketMeta.rooms.getAll = function(socket, data, callback) {
|
||||
categories: roomClients.categories ? roomClients.categories.length : 0,
|
||||
recent: roomClients.recent_posts ? roomClients.recent_posts.length : 0,
|
||||
topics: 0,
|
||||
category: 0
|
||||
category: 0,
|
||||
other: 0
|
||||
},
|
||||
topics: {}
|
||||
};
|
||||
@@ -119,10 +120,14 @@ SocketMeta.rooms.getAll = function(socket, data, callback) {
|
||||
}
|
||||
} else if (room.match(/^category/)) {
|
||||
socketData.users.category += roomClients[room].length;
|
||||
} else if (room !== 'categories' && room !== 'recent_posts') {
|
||||
socketData.users.other += roomClients[room].length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var scoreKeys = Object.keys(scores),
|
||||
mostActive = scoreKeys.sort();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user