<commit_before>RocketChat.models.Users = new class extends RocketChat.models._Base
	constructor: ->
		@model = Meteor.users

		@tryEnsureIndex { 'roles': 1 }, { sparse: 1 }


	# FIND ONE
	findOneById: (_id, options) ->
		return @findOne _id, options

	findOneByUsername: (username, options) ->
		query =
			username: username

		return @findOne query, options

	findOneByEmailAddress: (emailAddress, options) ->
		query =
			'emails.address': emailAddress

		return @findOne query, options

	findOneVerifiedFromSameDomain: (email, options) ->
		domain = s.strRight(email, '@')<commit_msg>Add index to Users name<commit_after>RocketChat.models.Users = new class extends RocketChat.models._Base
	constructor: ->
		@model = Meteor.users

		@tryEnsureIndex { 'roles': 1 }, { sparse: 1 }
		@tryEnsureIndex { 'name': 1 }


	# FIND ONE
	findOneById: (_id, options) ->
		return @findOne _id, options

	findOneByUsername: (username, options) ->
		query =
			username: username

		return @findOne query, options

	findOneByEmailAddress: (emailAddress, options) ->
		query =
			'emails.address': emailAddress

		return @findOne query, options

	findOneVerifiedFromSameDomain: (email, options) ->
		domain = s.strRight(email, '@')
{'fraction_non_alphanumeric': 0.11986863711001643, 'fraction_numerical': 0.004105090311986864, 'mean_word_length': 4.254310344827586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1882505', 'n_tokens_mistral': 438, 'n_tokens_neox': 390, 'n_words': 101}