fix getUser calls

This commit is contained in:
reality 2014-09-04 14:48:20 +00:00
parent c519727b6c
commit e096daa605
5 changed files with 12 additions and 13 deletions

View File

@ -187,7 +187,7 @@ var lastfm = function(dbot) {
.value(); .value();
async.each(scrobbliest, function(item, done) { 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; item.user = user;
done(); done();
}); });
@ -327,9 +327,9 @@ var lastfm = function(dbot) {
async.each(tastiest, function(pair, done) { async.each(tastiest, function(pair, done) {
if(!_.isObject(pair.p1)) { // fix this 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; pair.p1 = user;
dbot.api.users.getUser(pair.p2, function(user) { dbot.api.users.getUser(pair.p2, function(err, user) {
pair.p2 = user; pair.p2 = user;
done(); done();
}); });

View File

@ -15,7 +15,7 @@ var pages = function(dbot) {
var voterNicks = []; var voterNicks = [];
async.each(_.keys(poll.votees), function(id, done) { 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); voterNicks.push(user.primaryNick);
done(); done();
}); });

View File

@ -7,7 +7,7 @@ var pages = function(dbot) {
var connection = req.params.connection; var connection = req.params.connection;
var nick = req.params.user; var nick = req.params.user;
dbot.api.users.resolveUser(connection, nick, function(user){ dbot.api.users.resolveUser(connection, nick, function(err, user){
if(user){ if(user){
dbot.api.profile.getProfile(connection, user.primaryNick, function(err, user, profile){ dbot.api.profile.getProfile(connection, user.primaryNick, function(err, user, profile){
if(!err){ if(!err){
@ -45,7 +45,7 @@ var pages = function(dbot) {
dbot.api.profile.getAllProfiles(function(profiles){ dbot.api.profile.getAllProfiles(function(profiles){
var thumbnails = []; var thumbnails = [];
_.each(profiles, function(profile){ _.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){ if(user){
/*TODO(@tmenari / @samstudio8) /*TODO(@tmenari / @samstudio8)

View File

@ -33,7 +33,7 @@ var pages = function(dbot) {
}); });
async.eachSeries(userCount, function(userCount, next) { 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) { if(user) {
userCount['name'] = user.primaryNick; userCount['name'] = user.primaryNick;
users.push(userCount); users.push(userCount);
@ -72,7 +72,7 @@ var pages = function(dbot) {
}); });
}.bind(this), function() { }.bind(this), function() {
async.each(notifications, function(notify, done) { 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; if(user) notify.user = user.primaryNick;
done(); done();
}); });
@ -138,7 +138,7 @@ var pages = function(dbot) {
var pNickCache = {}; var pNickCache = {};
async.eachSeries(notifies, function(notify, next) { async.eachSeries(notifies, function(notify, next) {
if(!_.has(pNickCache, notify.user)) { 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; pNickCache[notify.user] = user.primaryNick;
notify.user = user.primaryNick; notify.user = user.primaryNick;
next(); next();
@ -163,7 +163,7 @@ var pages = function(dbot) {
} else { } else {
var username = req.params.item; 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', { this.db.search('notifies', {
'user': user.id 'user': user.id
}, function(notify) { }, function(notify) {

View File

@ -21,7 +21,7 @@ var pages = function(dbot) {
if(!_.include(userIds, warning.warnee)) userIds.push(warning.warnee); if(!_.include(userIds, warning.warnee)) userIds.push(warning.warnee);
}, function(err) { }, function(err) {
async.eachSeries(userIds, function(id, callback) { 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); userNicks.push(user.primaryNick);
callback(false); callback(false);
}); });
@ -47,9 +47,8 @@ var pages = function(dbot) {
}, function(warning) { }, function(warning) {
warnings.push(warning); warnings.push(warning);
}, function(err) { }, function(err) {
console.log(warnings);
async.eachSeries(warnings, function(warning, callback) { 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; warning.warner = user.primaryNick;
callback(false); callback(false);
}); });