<commit_before>/* globals WebRTC */

Template.membersList.helpers({
	tAddUsers() {
		return t('Add_users');
	},

	isGroupChat() {
		return ['c', 'p'].includes(ChatRoom.findOne(this.rid, { reactive: false }).t);
	},

	isDirectChat() {
		return ChatRoom.findOne(this.rid, { reactive: false }).t === 'd';
	},

	seeAll() {
		if (Template.instance().showAllUsers.get()) {
			return t('Show_only_online');
		} else {
			return t('Show_all');
		}
	},

	roomUsers() {
		const onlineUsers = RoomManager.onlineUsers.get();
		const roomUsernames = Template.instance().users.get();
		const room = ChatRoom.findOne(this.rid);
		const roomMuted = (room != null ? room.muted : undefined) || [];
		const userUtcOffset = Meteor.user().utcOffset;
		let totalOnline = 0;
		let users = roomUsernames.map(function(username) {
			let utcOffset;
			if (onlineUsers[username] != null) {
				totalOnline++;
				({ utcOffset } = onlineUsers[username]);

				if (utcOffset != null) {
					if (utcOffset === userUtcOffset) {
						utcOffset = '';
					} else if (utcOffset > 0) {
						utcOffset = `+${ utcOffset }`;
					} else {
						utcOffset = `(UTC ${ utcOffset })`;
					}
				}
			}

			return {
				username,
				status: (onlineUsers[username] != null ? onlineUsers[username].status : undefined),
				muted: Array.from(roomMuted).includes(username),
				utcOffset
			};
		});

		users = _.sortBy(users, 'username');
		// show online users first.
		// sortBy is stable, so we can do this
		users = _.sortBy(users, u => u.status == null);

		let hasMore = undefined;
		const usersLimit = Template.instance().usersLimit.get();
		if (usersLimit) {<commit_msg>Fix UTC offset bug when positive<commit_after>/* globals WebRTC */

Template.membersList.helpers({
	tAddUsers() {
		return t('Add_users');
	},

	isGroupChat() {
		return ['c', 'p'].includes(ChatRoom.findOne(this.rid, { reactive: false }).t);
	},

	isDirectChat() {
		return ChatRoom.findOne(this.rid, { reactive: false }).t === 'd';
	},

	seeAll() {
		if (Template.instance().showAllUsers.get()) {
			return t('Show_only_online');
		} else {
			return t('Show_all');
		}
	},

	roomUsers() {
		const onlineUsers = RoomManager.onlineUsers.get();
		const roomUsernames = Template.instance().users.get();
		const room = ChatRoom.findOne(this.rid);
		const roomMuted = (room != null ? room.muted : undefined) || [];
		const userUtcOffset = Meteor.user().utcOffset;
		let totalOnline = 0;
		let users = roomUsernames.map(function(username) {
			let utcOffset;
			if (onlineUsers[username] != null) {
				totalOnline++;
				({ utcOffset } = onlineUsers[username]);

				if (utcOffset != null) {
					if (utcOffset === userUtcOffset) {
						utcOffset = '';
					} else if (utcOffset > 0) {
						utcOffset = `(UTC +${ utcOffset })`;
					} else {
						utcOffset = `(UTC ${ utcOffset })`;
					}
				}
			}

			return {
				username,
				status: (onlineUsers[username] != null ? onlineUsers[username].status : undefined),
				muted: Array.from(roomMuted).includes(username),
				utcOffset
			};
		});

		users = _.sortBy(users, 'username');
		// show online users first.
		// sortBy is stable, so we can do this
		users = _.sortBy(users, u => u.status == null);

		let hasMore = undefined;
		const usersLimit = Template.instance().usersLimit.get();
		if (usersLimit) {
{'fraction_non_alphanumeric': 0.16621170761298149, 'fraction_numerical': 0.001213224143160449, 'mean_word_length': 3.345191040843215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2400745', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1105, 'n_words': 240}