Skip to content

Commit

Permalink
fix lint 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Jul 17, 2018
1 parent d6ae343 commit 72dfc16
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import s from 'underscore.string';

let usernameBlackList = [];

const trimUsername = username => username.trim();

const toRegExp = username => new RegExp(`^${s.escapeRegExp(username)}$`, 'i');
const toRegExp = username => new RegExp(`^${ s.escapeRegExp(username).trim() }$`, 'i');

RocketChat.settings.get('Accounts_BlockedUsernameList', (key, value) => {
usernameBlackList = value.split(',').map(value).map(toRegExp);
usernameBlackList = value.split(',').map(toRegExp);
});

const usernameIsBlocked = (username, usernameBlackList) => usernameBlackList.length
Expand All @@ -22,7 +20,7 @@ RocketChat.checkUsernameAvailability = function(username) {

return !Meteor.users.findOne({
username: {
$regex: new RegExp(`^${ s.trim(s.escapeRegExp(username)) }$`, 'i')
$regex: toRegExp(username)
}
}, { fields: { _id: 1 } });
};

0 comments on commit 72dfc16

Please sign in to comment.