Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit 401bd02748

@ -73,15 +73,6 @@ define(['forum/accountheader'], function(header) {
socket.emit('user.isOnline', theirid, Account.handleUserOnline); socket.emit('user.isOnline', theirid, Account.handleUserOnline);
socket.on('event:new_post', function(data) {
templates.preload_template('account', function() {
templates['account'].parse({posts:[]});
var html = templates.prepare(templates['account'].blocks['posts']).parse(data);
$('.user-recent-posts').prepend(html);
$('.user-recent-posts span.timeago').timeago();
});
});
}); });
}; };

@ -735,6 +735,10 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
}); });
socket.on('event:new_post', function(data) { socket.on('event:new_post', function(data) {
if(data && data.posts && data.posts.length && data.posts[0].tid !== templates.get('topic_id')) {
return;
}
if(config.usePagination) { if(config.usePagination) {
onNewPostPagination(data); onNewPostPagination(data);
return; return;

@ -59,8 +59,8 @@ var db = require('./database'),
}; };
Categories.getCategoryById = function(cid, start, end, uid, callback) { Categories.getCategoryById = function(cid, start, end, uid, callback) {
CategoryTools.exists(cid, function(err, exists) { Categories.getCategoryData(cid, function(err, category) {
if(err || !exists) { if(err || !category) {
return callback(err || new Error('category-not-found [' + cid + ']')); return callback(err || new Error('category-not-found [' + cid + ']'));
} }
@ -69,9 +69,6 @@ var db = require('./database'),
} }
async.parallel({ async.parallel({
category: function(next) {
Categories.getCategoryData(cid, next);
},
topics: function(next) { topics: function(next) {
Categories.getCategoryTopics(cid, start, end, uid, next); Categories.getCategoryTopics(cid, start, end, uid, next);
}, },
@ -83,7 +80,6 @@ var db = require('./database'),
return callback(err); return callback(err);
} }
var category = results.category;
category.topics = results.topics.topics; category.topics = results.topics.topics;
category.nextStart = results.topics.nextStart; category.nextStart = results.topics.nextStart;
category.pageCount = results.pageCount; category.pageCount = results.pageCount;

@ -232,48 +232,47 @@ var db = require('./database'),
return callback(err); return callback(err);
} }
postTools.parseSignature(userData.signature, function(err, signature) { post.user = {
if(err) { username: userData.username || 'anonymous',
return callback(err); userslug: userData.userslug || '',
} reputation: userData.reputation || 0,
postcount: userData.postcount || 0,
post.username = userData.username || 'anonymous'; banned: parseInt(userData.banned, 10) === 1,
post.userslug = userData.userslug || ''; picture: userData.picture || gravatar.url('', {}, true)
post.user_rep = userData.reputation || 0; };
post.user_postcount = userData.postcount || 0;
post.user_banned = parseInt(userData.banned, 10) === 1; for (var info in customUserInfo) {
post.picture = userData.picture || gravatar.url('', {}, true); if (customUserInfo.hasOwnProperty(info)) {
post.user[info] = userData[info] || customUserInfo[info];
if(meta.config.disableSignatures === undefined || parseInt(meta.config.disableSignatures, 10) === 0) {
post.signature = signature;
} }
}
for (var info in customUserInfo) { async.parallel({
if (customUserInfo.hasOwnProperty(info)) { signature: function(next) {
post[info] = userData[info] || customUserInfo[info]; if (parseInt(meta.config.disableSignatures, 10) !== 1) {
return postTools.parseSignature(userData.signature, next);
} }
} next();
},
plugins.fireHook('filter:posts.custom_profile_info', {profile: [], uid: post.uid, pid: post.pid}, function(err, profile_info) { editor: function(next) {
if(err) { if (!post.editor) {
return callback(err); return next();
} }
post.custom_profile_info = profile_info.profile; user.getUserFields(post.editor, ['username', 'userslug'], next);
},
customProfileInfo: function(next) {
plugins.fireHook('filter:posts.custom_profile_info', {profile: [], uid: post.uid, pid: post.pid}, next);
}
}, function(err, results) {
if (err) {
return callback(err);
}
if (post.editor !== '') { post.user.signature = results.signature;
user.getUserFields(post.editor, ['username', 'userslug'], function(err, editorData) { post.editor = results.editor;
if (err) { post.custom_profile_info = results.profile;
return callback(err);
}
post.editorname = editorData.username; callback(null, post);
post.editorslug = editorData.userslug;
callback(null, post);
});
} else {
callback(null, post);
}
});
}); });
}); });
}; };

@ -719,7 +719,7 @@ var async = require('async'),
if (categoryCache[topicData.cid]) { if (categoryCache[topicData.cid]) {
return next(null, categoryCache[topicData.cid]); return next(null, categoryCache[topicData.cid]);
} }
categories.getCategoryFields(topicData.cid, ['name', 'slug', 'icon'], next); categories.getCategoryFields(topicData.cid, ['name', 'slug', 'icon', 'bgColor', 'color'], next);
}, },
user: function(next) { user: function(next) {
if (userCache[topicData.uid]) { if (userCache[topicData.uid]) {

Loading…
Cancel
Save