<commit_before>Meteor.methods
	joinDefaultChannels: ->
		if not Meteor.userId()
			throw new Meteor.Error('invalid-user', "[methods] joinDefaultChannels -> Invalid user")

		user = Meteor.user()

		RocketChat.callbacks.run 'beforeJoinDefaultChannels', user

		RocketChat.models.Rooms.findByDefaultAndTypes(true, ['c', 'p']).forEach (room) ->

			# put user in default rooms
			RocketChat.models.Rooms.addUsernameById room._id, user.username

			if not RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(room._id, user._id)?

				# Add a subscription to this user
				RocketChat.models.Subscriptions.createWithRoomAndUser room, user,
					ts: new Date()
					open: true<commit_msg>Do not get field `usernames` with room on joinDefaultChannel<commit_after>Meteor.methods
	joinDefaultChannels: ->
		if not Meteor.userId()
			throw new Meteor.Error('invalid-user', "[methods] joinDefaultChannels -> Invalid user")

		user = Meteor.user()

		RocketChat.callbacks.run 'beforeJoinDefaultChannels', user

		RocketChat.models.Rooms.findByDefaultAndTypes(true, ['c', 'p'], {fields: {usernames: 0}}).forEach (room) ->

			# put user in default rooms
			RocketChat.models.Rooms.addUsernameById room._id, user.username

			if not RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(room._id, user._id)?

				# Add a subscription to this user
				RocketChat.models.Subscriptions.createWithRoomAndUser room, user,
					ts: new Date()
					open: true
{'fraction_non_alphanumeric': 0.11141868512110727, 'fraction_numerical': 0.0006920415224913495, 'mean_word_length': 4.561538461538461, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3956080', 'n_tokens_mistral': 518, 'n_tokens_neox': 448, 'n_words': 104}