-

+

{posts.username}
diff --git a/src/favourites.js b/src/favourites.js
index 3737e1cc66..675a9fa285 100644
--- a/src/favourites.js
+++ b/src/favourites.js
@@ -91,9 +91,10 @@ var RDB = require('./redis.js'),
data[post_id] = hasFavourited;
loaded ++;
- if (loaded == pids.length) callback(data);
+ if (loaded === pids.length)
+ callback(data);
});
- }(pids[i]))
+ }(pids[i]));
}
}
diff --git a/src/postTools.js b/src/postTools.js
index 46fec16701..e54cef7061 100644
--- a/src/postTools.js
+++ b/src/postTools.js
@@ -116,65 +116,5 @@ marked.setOptions({
});
}
- PostTools.constructPostObject = function(rawPosts, tid, current_user, privileges, callback) {
- var postObj = [];
-
- async.waterfall([
- function(next) {
- if (!privileges) {
- threadTools.privileges(tid, current_user, function(privs) {
- privileges = privs;
- next();
- });
- } else {
- next();
- }
- },
- function(next) {
- var postData = rawPosts.postData,
- userData = rawPosts.userData,
- voteData = rawPosts.voteData;
-
- if (!postData) {
- return next(null, []);
- }
-
- for (var i=0, ii= postData.pid.length; i 0) {
if (parseInt(data.tid) > 0) {
- topics.get_topic(data.tid, uid, function(topicData) {
- topicData.tid = data.tid;
- if (data.body) topicData.body = data.body;
+ topics.getTopicData(data.tid, function(topicData) {
+
+ if (data.body)
+ topicData.body = data.body;
+
socket.emit('api:composer.push', {
tid: data.tid,
title: topicData.title
@@ -416,14 +418,10 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
var start = data.after,
end = start + 10;
- posts.getPostsByTid(data.tid, start, end, function(posts){
- if (!posts.error) {
- postTools.constructPostObject(posts, data.tid, uid, null, function(postObj) {
- io.sockets.in('topic_' + data.tid).emit('event:new_post', {
- posts: postObj
- });
- });
- }
+ topics.getTopicPosts(data.tid, start, end, uid, function(posts) {
+ io.sockets.in('topic_' + data.tid).emit('event:new_post', {
+ posts: posts
+ });
});
});