Merge branch 'master' into story-138524853-domain-whitelist

This commit is contained in:
gaba
2017-02-06 14:53:46 -08:00
22 changed files with 561 additions and 85 deletions
+19
View File
@@ -353,6 +353,25 @@ module.exports = class UsersService {
return UserModel.update({id}, {$set: {status}});
}
/**
* Set the display name of a user.
* @param {String} id id of a user
* @param {String} displayName display name to set
* @param {Function} done callback after the operation is complete
*/
static setDisplayName(id, displayName) {
return UsersService.isValidDisplayName(displayName)
.then(() => { // displayName is valid
return UserModel.update(
{id},
{$set: {'displayName': displayName}})
.then(() => {
return UserModel.findOne({'id': id});
});
});
}
/**
* Finds a user with the id.
* @param {String} id user id (uuid)