diff --git a/public/templates/home.tpl b/public/templates/home.tpl index 23675bd306..8be6975834 100644 --- a/public/templates/home.tpl +++ b/public/templates/home.tpl @@ -3,7 +3,7 @@ {topics.title} - Posted {topics.relativeTime} by {topics.uid}. {topics.post_count} posts. + Posted {topics.relativeTime} by {topics.username}. {topics.post_count} posts. @@ -14,20 +14,6 @@ new_post.onclick = function() { } jQuery('document').ready(function() { - jQuery('.username').each(function() { - var userId = this.innerHTML; - - (function(span){ - socket.on('api:user.getNameByUid', function(username) { - span.innerHTML = username; - }); - })(this); - - socket.emit('api:user.getNameByUid', { fields: [ 'username' ], 'uid': userId }); - - }) - - diff --git a/src/topics.js b/src/topics.js index 6f92688c0e..01f1849a3b 100644 --- a/src/topics.js +++ b/src/topics.js @@ -1,6 +1,7 @@ var RDB = require('./redis.js'), posts = require('./posts.js'), - utils = require('./utils.js'); + utils = require('./utils.js'), + user = require('./user.js'); (function(Topics) { //data structure @@ -68,25 +69,33 @@ var RDB = require('./redis.js'), .mget(slug) .mget(postcount) .exec(function(err, replies) { + title = replies[0]; uid = replies[1]; timestamp = replies[2]; slug = replies[3]; postcount = replies[4]; - var topics = []; - for (var i=0, ii=title.length; i
Posted {topics.relativeTime} by {topics.uid}. {topics.post_count} posts.
Posted {topics.relativeTime} by {topics.username}. {topics.post_count} posts.