From 16537bc636289b28bade37ff1b64d0d692d7ed7d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 4 Feb 2015 00:37:08 -0500 Subject: [PATCH] prevent double callback --- src/groups.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/groups.js b/src/groups.js index 12d1c3a307..ed9f38f472 100644 --- a/src/groups.js +++ b/src/groups.js @@ -694,8 +694,14 @@ var async = require('async'), Groups.acceptMembership = function(groupName, uid, callback) { // Note: For simplicity, this method intentially doesn't check the caller uid for ownership! - db.setRemove('group:' + groupName + ':pending', uid, callback); - Groups.join.apply(Groups, arguments); + async.waterfall([ + function(next) { + db.setRemove('group:' + groupName + ':pending', uid, next); + }, + function(next) { + Groups.join(groupName, uid, next); + } + ], callback); }; Groups.rejectMembership = function(groupName, uid, callback) {