now getting topic names for topics presence chart; adjusted layout to make it more responsive

This commit is contained in:
psychobunny
2014-09-29 12:59:25 -04:00
parent dedf7a6715
commit 6a8ccf1ad5
4 changed files with 47 additions and 15 deletions

View File

@@ -10,6 +10,7 @@ var meta = require('../meta'),
nconf = require('nconf'),
gravatar = require('gravatar'),
winston = require('winston'),
validator = require('validator'),
websockets = require('./'),
SocketMeta = {
@@ -124,11 +125,18 @@ SocketMeta.rooms.getAll = function(socket, data, callback) {
topTenTopics = topTenTopics.concat(scores[mostActive.pop()]);
}
topTenTopics.splice(0, 9).slice(0,9).forEach(function(tid) {
socketData.topics[tid] = rooms['/topic_' + tid].length;
});
topTenTopics = topTenTopics.slice(0,9);
callback(null, socketData);
topics.getTopicsFields(topTenTopics, ['title'], function(err, titles) {
topTenTopics.forEach(function(tid, id) {
socketData.topics[tid] = {
value: rooms['/topic_' + tid].length,
title: validator.escape(titles[id].title)
}
});
callback(null, socketData);
});
};
/* Exports */