|
|
@ -196,7 +196,7 @@ module.exports = function (User) {
|
|
|
|
|
|
|
|
|
|
|
|
function updateUsername(uid, newUsername, callback) {
|
|
|
|
function updateUsername(uid, newUsername, callback) {
|
|
|
|
if (!newUsername) {
|
|
|
|
if (!newUsername) {
|
|
|
|
return callback();
|
|
|
|
return setImmediate(callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
async.waterfall([
|
|
|
@ -204,6 +204,9 @@ module.exports = function (User) {
|
|
|
|
User.getUserFields(uid, ['username', 'userslug'], next);
|
|
|
|
User.getUserFields(uid, ['username', 'userslug'], next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function (userData, next) {
|
|
|
|
function (userData, next) {
|
|
|
|
|
|
|
|
if (userData.username === newUsername) {
|
|
|
|
|
|
|
|
return callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
async.parallel([
|
|
|
|
async.parallel([
|
|
|
|
function (next) {
|
|
|
|
function (next) {
|
|
|
|
updateUidMapping('username', uid, newUsername, userData.username, next);
|
|
|
|
updateUidMapping('username', uid, newUsername, userData.username, next);
|
|
|
|