From ee71f982b7dc4b69e1c49cf424ae52479177aae6 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 28 Oct 2015 20:13:18 -0400 Subject: [PATCH] added missing filter:post.tools --- src/socket.io/posts/tools.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js index d05c2b74be..5830820cb6 100644 --- a/src/socket.io/posts/tools.js +++ b/src/socket.io/posts/tools.js @@ -7,14 +7,14 @@ var events = require('../../events'); var websockets = require('../index'); var socketTopics = require('../topics'); var privileges = require('../../privileges'); +var plugins = require('../../plugins'); var favourites = require('../../favourites'); - module.exports = function(SocketPosts) { SocketPosts.loadPostTools = function(socket, data, callback) { if (!data) { - return callback(new Error('[[error:invalid-data]]')) + return callback(new Error('[[error:invalid-data]]')); } async.parallel({ @@ -26,12 +26,15 @@ module.exports = function(SocketPosts) { }, favourited: function(next) { favourites.getFavouritesByPostIDs([data.pid], socket.uid, next); + }, + tools: function(next) { + plugins.fireHook('filter:post.tools', {pid: data.pid, uid: socket.uid, tools: []}, next); } }, function(err, results) { if (err) { return callback(err); } - results.posts.tools = []; // TODO: add filter for this + results.posts.tools = results.tools.tools; results.posts.deleted = parseInt(results.posts.deleted, 10) === 1; results.posts.favourited = results.favourited[0]; results.posts.selfPost = socket.uid && socket.uid === parseInt(results.posts.uid, 10);