From 9a4111c39351887ab6c54cb8ea30cc48ad306ec7 Mon Sep 17 00:00:00 2001 From: reality Date: Sat, 24 Aug 2013 20:42:30 +0000 Subject: [PATCH] ~mergeusershook for notify --- modules/report/report.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/report/report.js b/modules/report/report.js index c13f5b6..4ef2e8d 100644 --- a/modules/report/report.js +++ b/modules/report/report.js @@ -188,7 +188,14 @@ var report = function(dbot) { if(_.has(dbot.modules, 'web')) { dbot.api.web.addIndexLink('/notify', 'Notifications'); } - }; + + dbot.api.event.addHook('~mergeusers', function(server, oldUser, newUser) { + this.db.search('notifies', { 'user': oldUser.id }, function(notify) { + notify.user = newUser.id; + this.db.save('notifies', notify.id, notify, function() {}); + }.bind(this), function() {}); + }.bind(this)); + }.bind(this); }; exports.fetch = function(dbot) {