Skip to content

Node.js based forum software built for the modern web

prevent double callback

barisusakli16537bc63628
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) {