From f7372ba8d5e426ca7c12740ab358bc9504158eb7 Mon Sep 17 00:00:00 2001 From: dhingey Date: Tue, 8 Jul 2014 00:21:58 -0700 Subject: [PATCH] Added a hook: action:user.delete Allows plugins to access the uid of the user being deleted. --- docs/plugins/hooks.rst | 3 +++ src/user/delete.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index bd80b8fa2a..136b8cbe00 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -222,6 +222,9 @@ Executed whenever a notification is pushed to a user. ``action:user.create`` ^^^^^^^^^^^^^^^^^^^^^ +``action:user.delete`` +^^^^^^^^^^^^^^^^^^^^^ + ``action:topic.delete`` ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/user/delete.js b/src/user/delete.js index 1daa737992..b955104b37 100644 --- a/src/user/delete.js +++ b/src/user/delete.js @@ -5,7 +5,8 @@ var async = require('async'), posts = require('../posts'), user = require('../user'), topics = require('../topics'), - groups = require('../groups'); + groups = require('../groups'), + plugins = require('../plugins'); module.exports = function(User) { @@ -111,6 +112,7 @@ module.exports = function(User) { return callback(err); } + plugins.fireHook('action:user.delete', uid); async.parallel([ function(next) { db.delete('followers:' + uid, next);