diff --git a/package.json b/package.json index 1b5a8d5c..638be586 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.22.2", + "version": "3.22.3", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/account.js b/src/account.js index 0d9e01f6..d8e7d1ca 100644 --- a/src/account.js +++ b/src/account.js @@ -42,14 +42,15 @@ module.exports.getAccount = function (name, ip, opts, cb) { .then(function (aliases) { data.aliases = aliases; if (name && opts.registered) { - return Q.nfcall(db.users.getGlobalRank, name); + return Q.nfcall(db.users.getUser, name); } else if (name) { - return 0; + return { global_rank: 0, profile: { text: "", image: "" } }; } else { - return -1; + return { global_rank: -1, profile: { text: "", image: "" } }; } - }).then(function (globalRank) { - data.globalRank = globalRank; + }).then(function (user) { + data.globalRank = user.global_rank; + data.profile = user.profile; if (opts.channel && opts.registered) { return Q.nfcall(db.channels.getRank, opts.channel, name); } else { @@ -63,13 +64,6 @@ module.exports.getAccount = function (name, ip, opts, cb) { } }).then(function (chanRank) { data.channelRank = chanRank; - /* Look up profile for registered user */ - if (data.globalRank >= 1) { - return Q.nfcall(db.users.getProfile, name); - } else { - return { text: "", image: "" }; - } - }).then(function (profile) { setImmediate(function () { cb(null, new Account({ name: name, @@ -77,7 +71,7 @@ module.exports.getAccount = function (name, ip, opts, cb) { aliases: data.aliases, globalRank: data.globalRank, channelRank: data.channelRank, - profile: profile + profile: data.profile })); }); }).catch(function (err) {