From 8bc5330e8916236baaab56e3bb18f33afb35521e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 18 May 2015 16:01:40 -0400 Subject: [PATCH] some minor cleanup in the async tree... --- src/favourites.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/favourites.js b/src/favourites.js index 58a945e211..549b308de3 100644 --- a/src/favourites.js +++ b/src/favourites.js @@ -306,20 +306,22 @@ var async = require('async'), function(count, next) { results.postData.reputation = count; posts.setPostField(pid, 'reputation', count, next); - }, - function(next) { - plugins.fireHook('action:post.' + type, { - pid: pid, - uid: uid, - }, next); - }, - function(next) { - next(null, { - post: results.postData, - isFavourited: isFavouriting - }); } - ], callback); + ], function(err) { + if (err) { + return callback(err); + } + + plugins.fireHook('action:post.' + type, { + pid: pid, + uid: uid, + }); + + callback(null, { + post: results.postData, + isFavourited: isFavouriting + }); + }); }); }