mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 17:05:51 +01:00
added hooks action:groups.join and action:groups.leave
This commit is contained in:
@@ -444,6 +444,10 @@ var async = require('async'),
|
|||||||
Groups.exists(groupName, function(err, exists) {
|
Groups.exists(groupName, function(err, exists) {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
db.setAdd('group:' + groupName + ':members', uid, callback);
|
db.setAdd('group:' + groupName + ':members', uid, callback);
|
||||||
|
plugins.fireHook('action:groups.join', {
|
||||||
|
groupName: groupName,
|
||||||
|
uid: uid
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Groups.create(groupName, '', function(err) {
|
Groups.create(groupName, '', function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -452,6 +456,10 @@ var async = require('async'),
|
|||||||
}
|
}
|
||||||
Groups.hide(groupName);
|
Groups.hide(groupName);
|
||||||
db.setAdd('group:' + groupName + ':members', uid, callback);
|
db.setAdd('group:' + groupName + ':members', uid, callback);
|
||||||
|
plugins.fireHook('action:groups.join', {
|
||||||
|
groupName: groupName,
|
||||||
|
uid: uid
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -465,6 +473,11 @@ var async = require('async'),
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins.fireHook('action:groups.leave', {
|
||||||
|
groupName: groupName,
|
||||||
|
uid: uid
|
||||||
|
});
|
||||||
|
|
||||||
// If this is a hidden group, and it is now empty, delete it
|
// If this is a hidden group, and it is now empty, delete it
|
||||||
Groups.get(groupName, {}, function(err, group) {
|
Groups.get(groupName, {}, function(err, group) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user