Rename to `uniqueUsername`

v1.18.x
Peter Jaszkowiak 8 years ago
parent 642306e69c
commit a7677063de

@ -46,7 +46,7 @@ module.exports = function (User) {
async.parallel({ async.parallel({
renamedUsername: function (next) { renamedUsername: function (next) {
User.renameUsername(userData, next); User.uniqueUsername(userData, next);
}, },
userData: function (next) { userData: function (next) {
plugins.fireHook('filter:user.create', { user: userData, data: data }, next); plugins.fireHook('filter:user.create', { user: userData, data: data }, next);
@ -200,7 +200,7 @@ module.exports = function (User) {
callback(); callback();
}; };
User.renameUsername = function (userData, callback) { User.uniqueUsername = function (userData, callback) {
meta.userOrGroupExists(userData.userslug, function (err, exists) { meta.userOrGroupExists(userData.userslug, function (err, exists) {
if (err || !exists) { if (err || !exists) {
return callback(err); return callback(err);

@ -70,7 +70,7 @@ describe('User', function () {
}); });
}); });
describe('.renameUsername()', function () { describe('.uniqueUsername()', function () {
it('should deal with collisions', function (done) { it('should deal with collisions', function (done) {
var users = []; var users = [];
for (var i = 0; i < 10; i += 1) { for (var i = 0; i < 10; i += 1) {
@ -88,7 +88,7 @@ describe('User', function () {
}, next); }, next);
}, },
function (next) { function (next) {
User.renameUsername({ User.uniqueUsername({
username: 'Jane Doe', username: 'Jane Doe',
userslug: 'jane-doe', userslug: 'jane-doe',
}, function (err, username) { }, function (err, username) {

Loading…
Cancel
Save