From ab90d7b9d4e05553513cb18b2e8c8f969da02986 Mon Sep 17 00:00:00 2001 From: Martin Freisen Date: Sat, 27 Sep 2014 00:23:44 +0200 Subject: [PATCH] added hooks `action:groups.join` and `action:groups.leave` --- src/groups.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/groups.js b/src/groups.js index 2a04cfd69d..e1fe0d78e7 100644 --- a/src/groups.js +++ b/src/groups.js @@ -444,6 +444,10 @@ var async = require('async'), Groups.exists(groupName, function(err, exists) { if (exists) { db.setAdd('group:' + groupName + ':members', uid, callback); + plugins.fireHook('action:groups.join', { + groupName: groupName, + uid: uid + }); } else { Groups.create(groupName, '', function(err) { if (err) { @@ -452,6 +456,10 @@ var async = require('async'), } Groups.hide(groupName); 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); } + plugins.fireHook('action:groups.leave', { + groupName: groupName, + uid: uid + }); + // If this is a hidden group, and it is now empty, delete it Groups.get(groupName, {}, function(err, group) { if (err) {