From 397b732341dd1b7bc56bf616a2d5b8ac36fe03cc Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 25 Aug 2013 22:36:06 +0000 Subject: [PATCH] could it be? --- modules/users/api.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/users/api.js b/modules/users/api.js index 4edaf57..bbb79dc 100644 --- a/modules/users/api.js +++ b/modules/users/api.js @@ -10,18 +10,17 @@ var api = function(dbot) { var api = { // Return a user record given a primary nick or an alias 'resolveUser': function(server, nick, callback) { - var found = false; + var user = false; if(_.has(this.userCache[server], nick)) { this.api.getUser(this.userCache[server][nick], callback); } else { this.db.search('users', { 'server': server }, function(result) { if(result.primaryNick == nick || _.include(result.aliases, nick)) { this.userCache[server][nick] = result.id; - found = true; - callback(result); + user = result; } }.bind(this), function(err) { - if(!found) callback(false); + callback(user); }); } },