From 52cec92df8b91f4eb8179faacc6990f68df36392 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 24 Mar 2016 20:55:10 +0200 Subject: [PATCH] some cleanup, dont send ip on newpost --- src/socket.io/helpers.js | 20 ++++++++++++++------ src/socket.io/posts.js | 2 +- src/socket.io/topics.js | 30 +++--------------------------- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/socket.io/helpers.js b/src/socket.io/helpers.js index 5524faf156..12a0e9d9b5 100644 --- a/src/socket.io/helpers.js +++ b/src/socket.io/helpers.js @@ -16,6 +16,11 @@ var plugins = require('../plugins'); var SocketHelpers = {}; SocketHelpers.notifyOnlineUsers = function(uid, result) { + winston.warn('[deprecated] SocketHelpers.notifyOnlineUsers, consider using socketHelpers.notifyNew(uid, \'newPost\', result);'); + SocketHelpers.notifyNew(uid, 'newPost', result); +}; + +SocketHelpers.notifyNew = function(uid, type, result) { async.waterfall([ function(next) { user.getUidsFromSet('users:online', 0, -1, next); @@ -24,20 +29,23 @@ SocketHelpers.notifyOnlineUsers = function(uid, result) { privileges.topics.filterUids('read', result.posts[0].topic.tid, uids, next); }, function(uids, next) { - plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: uid, type: 'newPost'}, next); + plugins.fireHook('filter:sockets.sendNewPostToUids', {uidsTo: uids, uidFrom: uid, type: type}, next); } ], function(err, data) { if (err) { return winston.error(err.stack); } - var uids = data.uidsTo; + result.posts[0].ip = undefined; - for(var i=0; i