From e096daa605c491481d3e5bbe02bb72dae635d837 Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 4 Sep 2014 14:48:20 +0000 Subject: [PATCH] fix getUser calls --- modules/lastfm/lastfm.js | 6 +++--- modules/poll/pages.js | 2 +- modules/profile/pages.js | 4 ++-- modules/report/pages.js | 8 ++++---- modules/warning/pages.js | 5 ++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/lastfm/lastfm.js b/modules/lastfm/lastfm.js index 489e88c..77b7f8a 100644 --- a/modules/lastfm/lastfm.js +++ b/modules/lastfm/lastfm.js @@ -187,7 +187,7 @@ var lastfm = function(dbot) { .value(); async.each(scrobbliest, function(item, done) { - dbot.api.users.getUser(item.user, function(user) { + dbot.api.users.getUser(item.user, function(err, user) { item.user = user; done(); }); @@ -327,9 +327,9 @@ var lastfm = function(dbot) { async.each(tastiest, function(pair, done) { if(!_.isObject(pair.p1)) { // fix this - dbot.api.users.getUser(pair.p1, function(user) { + dbot.api.users.getUser(pair.p1, function(err, user) { pair.p1 = user; - dbot.api.users.getUser(pair.p2, function(user) { + dbot.api.users.getUser(pair.p2, function(err, user) { pair.p2 = user; done(); }); diff --git a/modules/poll/pages.js b/modules/poll/pages.js index a4df4db..b3b77cc 100644 --- a/modules/poll/pages.js +++ b/modules/poll/pages.js @@ -15,7 +15,7 @@ var pages = function(dbot) { var voterNicks = []; async.each(_.keys(poll.votees), function(id, done) { - dbot.api.users.getUser(id, function(user) { + dbot.api.users.getUser(id, function(err, user) { voterNicks.push(user.primaryNick); done(); }); diff --git a/modules/profile/pages.js b/modules/profile/pages.js index 73b4c08..309b36e 100644 --- a/modules/profile/pages.js +++ b/modules/profile/pages.js @@ -7,7 +7,7 @@ var pages = function(dbot) { var connection = req.params.connection; var nick = req.params.user; - dbot.api.users.resolveUser(connection, nick, function(user){ + dbot.api.users.resolveUser(connection, nick, function(err, user){ if(user){ dbot.api.profile.getProfile(connection, user.primaryNick, function(err, user, profile){ if(!err){ @@ -45,7 +45,7 @@ var pages = function(dbot) { dbot.api.profile.getAllProfiles(function(profiles){ var thumbnails = []; _.each(profiles, function(profile){ - var nick = dbot.api.users.getUser(profile.id, function(user){ + var nick = dbot.api.users.getUser(profile.id, function(err, user){ if(user){ /*TODO(@tmenari / @samstudio8) diff --git a/modules/report/pages.js b/modules/report/pages.js index 3c17030..07d814f 100644 --- a/modules/report/pages.js +++ b/modules/report/pages.js @@ -33,7 +33,7 @@ var pages = function(dbot) { }); async.eachSeries(userCount, function(userCount, next) { - dbot.api.users.getUser(userCount.id, function(user) { + dbot.api.users.getUser(userCount.id, function(err, user) { if(user) { userCount['name'] = user.primaryNick; users.push(userCount); @@ -72,7 +72,7 @@ var pages = function(dbot) { }); }.bind(this), function() { async.each(notifications, function(notify, done) { - dbot.api.users.getUser(notify.user, function(user) { + dbot.api.users.getUser(notify.user, function(err, user) { if(user) notify.user = user.primaryNick; done(); }); @@ -138,7 +138,7 @@ var pages = function(dbot) { var pNickCache = {}; async.eachSeries(notifies, function(notify, next) { if(!_.has(pNickCache, notify.user)) { - dbot.api.users.getUser(notify.user, function(user) { + dbot.api.users.getUser(notify.user, function(err, user) { pNickCache[notify.user] = user.primaryNick; notify.user = user.primaryNick; next(); @@ -163,7 +163,7 @@ var pages = function(dbot) { } else { var username = req.params.item; - dbot.api.users.resolveUser(server, username, function(user) { + dbot.api.users.resolveUser(server, username, function(err, user) { this.db.search('notifies', { 'user': user.id }, function(notify) { diff --git a/modules/warning/pages.js b/modules/warning/pages.js index 298db12..cb105fa 100644 --- a/modules/warning/pages.js +++ b/modules/warning/pages.js @@ -21,7 +21,7 @@ var pages = function(dbot) { if(!_.include(userIds, warning.warnee)) userIds.push(warning.warnee); }, function(err) { async.eachSeries(userIds, function(id, callback) { - dbot.api.users.getUser(id, function(user) { + dbot.api.users.getUser(id, function(err, user) { userNicks.push(user.primaryNick); callback(false); }); @@ -47,9 +47,8 @@ var pages = function(dbot) { }, function(warning) { warnings.push(warning); }, function(err) { - console.log(warnings); async.eachSeries(warnings, function(warning, callback) { - dbot.api.users.getUser(warning.warner, function(user) { + dbot.api.users.getUser(warning.warner, function(err, user) { warning.warner = user.primaryNick; callback(false); });