mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
post tests
This commit is contained in:
@@ -31,25 +31,26 @@ SocketPosts.reply = function (socket, data, callback) {
|
||||
data.req = websockets.reqFromSocket(socket);
|
||||
data.timestamp = Date.now();
|
||||
|
||||
topics.reply(data, function (err, postData) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
topics.reply(data, next);
|
||||
},
|
||||
function (postData, next) {
|
||||
var result = {
|
||||
posts: [postData],
|
||||
'reputation:disabled': parseInt(meta.config['reputation:disabled'], 10) === 1,
|
||||
'downvote:disabled': parseInt(meta.config['downvote:disabled'], 10) === 1,
|
||||
};
|
||||
|
||||
next(null, postData);
|
||||
|
||||
websockets.in('uid_' + socket.uid).emit('event:new_post', result);
|
||||
|
||||
user.updateOnlineUsers(socket.uid);
|
||||
|
||||
socketHelpers.notifyNew(socket.uid, 'newPost', result);
|
||||
}
|
||||
|
||||
var result = {
|
||||
posts: [postData],
|
||||
'reputation:disabled': parseInt(meta.config['reputation:disabled'], 10) === 1,
|
||||
'downvote:disabled': parseInt(meta.config['downvote:disabled'], 10) === 1,
|
||||
};
|
||||
|
||||
callback(null, postData);
|
||||
|
||||
websockets.in('uid_' + socket.uid).emit('event:new_post', result);
|
||||
|
||||
user.updateOnlineUsers(socket.uid);
|
||||
|
||||
socketHelpers.notifyNew(socket.uid, 'newPost', result);
|
||||
});
|
||||
], callback);
|
||||
};
|
||||
|
||||
SocketPosts.getRawPost = function (socket, pid, callback) {
|
||||
@@ -120,7 +121,7 @@ SocketPosts.getPidIndex = function (socket, data, callback) {
|
||||
|
||||
SocketPosts.getReplies = function (socket, pid, callback) {
|
||||
if (!utils.isNumber(pid)) {
|
||||
return callback(new Error('[[error:invalid-data]'));
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
var postPrivileges;
|
||||
async.waterfall([
|
||||
|
||||
Reference in New Issue
Block a user