mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
flat is good
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
var async = require('async'),
|
||||
nconf = require('nconf'),
|
||||
winston = require('winston'),
|
||||
|
||||
db = require('../database'),
|
||||
posts = require('../posts'),
|
||||
@@ -46,17 +47,22 @@ SocketPosts.reply = function(socket, data, callback) {
|
||||
|
||||
socket.emit('event:new_post', result);
|
||||
|
||||
user.getUidsFromSet('users:online', 0, -1, function(err, uids) {
|
||||
if (err) {
|
||||
return;
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
user.getUidsFromSet('users:online', 0, -1, next);
|
||||
},
|
||||
function(uids, next) {
|
||||
privileges.categories.filterUids('read', postData.topic.cid, uids, next);
|
||||
},
|
||||
function(uids, next) {
|
||||
plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: data.uid, type: 'newPost'}, next);
|
||||
}
|
||||
privileges.categories.filterUids('read', postData.topic.cid, uids, function(err, uids) {
|
||||
], function(err, data) {
|
||||
if (err) {
|
||||
return;
|
||||
return winston.error(err.stack);
|
||||
}
|
||||
|
||||
plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: data.uid, type: "newPost"}, function(err, data) {
|
||||
uids = data.uidsTo;
|
||||
var uids = data.uidsTo;
|
||||
|
||||
for(var i=0; i<uids.length; ++i) {
|
||||
if (parseInt(uids[i], 10) !== socket.uid) {
|
||||
@@ -65,8 +71,6 @@ SocketPosts.reply = function(socket, data, callback) {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
SocketPosts.getVoters = function(socket, data, callback) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
var nconf = require('nconf'),
|
||||
async = require('async'),
|
||||
winston = require('winston'),
|
||||
|
||||
topics = require('../topics'),
|
||||
categories = require('../categories'),
|
||||
@@ -41,18 +42,22 @@ SocketTopics.post = function(socket, data, callback) {
|
||||
socket.emit('event:new_post', {posts: [result.postData]});
|
||||
socket.emit('event:new_topic', result.topicData);
|
||||
|
||||
user.getUidsFromSet('users:online', 0, -1, function(err, uids) {
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
user.getUidsFromSet('users:online', 0, -1, next);
|
||||
},
|
||||
function(uids, next) {
|
||||
privileges.categories.filterUids('read', result.topicData.cid, uids, next);
|
||||
},
|
||||
function(uids, next) {
|
||||
plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: data.uid, type: 'newTopic'}, next);
|
||||
}
|
||||
], function(err, data) {
|
||||
if (err) {
|
||||
return;
|
||||
return winston.error(err.stack);
|
||||
}
|
||||
|
||||
privileges.categories.filterUids('read', result.topicData.cid, uids, function(err, uids) {
|
||||
if (err) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: data.uid, type: "newTopic"}, function(err, data) {
|
||||
uids = data.uidsTo;
|
||||
var uids = data.uidsTo;
|
||||
|
||||
for(var i=0; i<uids.length; ++i) {
|
||||
if (parseInt(uids[i], 10) !== socket.uid) {
|
||||
@@ -62,8 +67,6 @@ SocketTopics.post = function(socket, data, callback) {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
SocketTopics.enter = function(socket, tid, callback) {
|
||||
|
||||
Reference in New Issue
Block a user