From de54ec5c61e7ff6b36f8860bd0e3ff01fd65b65c Mon Sep 17 00:00:00 2001 From: reality Date: Sat, 24 Aug 2013 18:32:52 +0000 Subject: [PATCH] [close #569] --- modules/users/api.js | 15 ++++++++++----- modules/users/commands.js | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/users/api.js b/modules/users/api.js index ab51e0e..a520d48 100644 --- a/modules/users/api.js +++ b/modules/users/api.js @@ -40,7 +40,6 @@ var api = function(dbot) { } }, function(err) { if(!err) { - console.log(nicks); callback(users, nicks); } }); @@ -48,10 +47,16 @@ var api = function(dbot) { // Return a user record given a UUID 'getUser': function(uuid, callback) { - this.db.read('users', uuid, function(err, user) { - if(err) user = false; - callback(user); - }); + this.db.read('user_redirs', uuid, function(err, id) { + if(!err) { + this.api.getUser(id, callback); + } else { + this.db.read('users', uuid, function(err, user) { + if(err) user = false; + callback(user); + }); + } + }.bind(this)); }, 'resolveChannel': function(server, channelName, callback) { diff --git a/modules/users/commands.js b/modules/users/commands.js index 81b7b36..6c27f39 100644 --- a/modules/users/commands.js +++ b/modules/users/commands.js @@ -119,6 +119,7 @@ var commands = function(dbot) { this.internalAPI.mergeChannelUsers(oldUser, user); this.db.del('users', oldUser.id, function(err) { if(!err) { + this.db.save('user_redirs', oldUser.id, user.id, function() {}); this.db.save('users', user.id, user, function(err) { if(!err) { event.reply(dbot.t('merged_users', {