Skip to content

Node.js based forum software built for the modern web

sending in groupObj data into group.delete hook

Julian Lam8d2326532490
diff --git a/src/groups.js b/src/groups.js
index f2d9b38e9a..696d8a690f 100644
--- a/src/groups.js
+++ b/src/groups.js
@@ -556,31 +556,27 @@ var async = require('async'),
}
Groups.destroy = function(groupName, callback) {
- async.parallel([
- async.apply(db.delete, 'group:' + groupName),
- async.apply(db.setRemove, 'groups', groupName),
- async.apply(db.delete, 'group:' + groupName + ':members'),
- async.apply(db.delete, 'group:' + groupName + ':pending'),
- async.apply(db.delete, 'group:' + groupName + ':owners'),
- function(next) {
- db.getSetMembers('groups', function(err, groups) {
- if (err) {
- return next(err);
- }
- async.each(groups, function(group, next) {
- db.setRemove('group:' + group + ':members', groupName, next);
- }, next);
- });
- }
- ], function(err) {
- if (!err) {
- plugins.fireHook('action:group.destroy', {
- name: groupName
- });
- }
-
- callback(err);
- });
+ Groups.get(groupName, {}, function(err, groupObj) {
+ plugins.fireHook('action:group.destroy', groupObj);
+
+ async.parallel([
+ async.apply(db.delete, 'group:' + groupName),
+ async.apply(db.setRemove, 'groups', groupName),
+ async.apply(db.delete, 'group:' + groupName + ':members'),
+ async.apply(db.delete, 'group:' + groupName + ':pending'),
+ async.apply(db.delete, 'group:' + groupName + ':owners'),
+ function(next) {
+ db.getSetMembers('groups', function(err, groups) {
+ if (err) {
+ return next(err);
+ }
+ async.each(groups, function(group, next) {
+ db.setRemove('group:' + group + ':members', groupName, next);
+ }, next);
+ });
+ }
+ ], callback);
+ })
};
Groups.join = function(groupName, uid, callback) {