<commit_before>app.controller('HeaderController', function ($rootScope, $stateParams, $state, $modal, bunkerData, $location, $anchorScroll) {
	var self = this;

	bunkerData.$promise.then(function () {
		self.rooms = bunkerData.rooms;
		self.memberships = bunkerData.memberships;
		self.settings = bunkerData.userSettings;
		self.inbox = bunkerData.inbox;
		self.unreadInboxMessages = _.select(self.inbox, {read: false}).length;
	});

	this.showOptions = !$state.is('lobby');

	this.changeSetting = function (settingName) {
		bunkerData.toggleUserSetting(settingName, settingName == 'desktopMentionNotifications');
		if (settingName == 'showDebugging' && bunkerData.userSettings.showDebugging) {
			angular.reloadWithDebugInfo();
		}
	};

	this.leaveRoom = function () {
		bunkerData.leaveRoom($rootScope.roomId)
			.then(function () {
				$state.go('lobby');
			});
	};

	this.toggleEmoticonMenu = function () {
		this.emoticonMenu = !this.emoticonMenu;
		this.inboxOpened = false;
	};

	this.toggleInbox = function () {
		this.emoticonMenu = false;
		this.inboxOpened = !this.inboxOpened;

		if (this.inboxOpened) {
			bunkerData.markInboxRead()
				.then(function () {
					_.each(self.inbox, function (inboxMessage) {
						inboxMessage.read = true;
					});
					self.unreadInboxMessages = _.select(self.inbox, {read: false}).length;
				});
		}
	};

	this.showHelp = function () {
		$modal.open({
			templateUrl: '/assets/app/help/help.html',
			controller: 'HelpController',
			size: 'lg'
		});
	};

	this.dragRoomListeners = {
		orderChanged: function roomOrderChanged(evt) {
			for (var i = 0; i < self.rooms.length; i++) {
				var room = self.rooms[i];

				// check each membership
				var membership = _.findWhere(self.memberships, {room: room.id});

				membership.roomOrder = i;
			}
			bunkerData.saveRoomMemberSettings(self.memberships);
		}
	};

	this.clearInbox = bunkerData.clearInbox;

	this.goToRoom = function (message) {
		self.inboxOpened = false;

		//check if room still has message loaded
		var room = _.find(bunkerData.rooms, {id: message.room});<commit_msg>made clear inbox close the inbox window<commit_after>app.controller('HeaderController', function ($rootScope, $stateParams, $state, $modal, bunkerData, $location, $anchorScroll) {
	var self = this;

	bunkerData.$promise.then(function () {
		self.rooms = bunkerData.rooms;
		self.memberships = bunkerData.memberships;
		self.settings = bunkerData.userSettings;
		self.inbox = bunkerData.inbox;
		self.unreadInboxMessages = _.select(self.inbox, {read: false}).length;
	});

	this.showOptions = !$state.is('lobby');

	this.changeSetting = function (settingName) {
		bunkerData.toggleUserSetting(settingName, settingName == 'desktopMentionNotifications');
		if (settingName == 'showDebugging' && bunkerData.userSettings.showDebugging) {
			angular.reloadWithDebugInfo();
		}
	};

	this.leaveRoom = function () {
		bunkerData.leaveRoom($rootScope.roomId)
			.then(function () {
				$state.go('lobby');
			});
	};

	this.toggleEmoticonMenu = function () {
		this.emoticonMenu = !this.emoticonMenu;
		this.inboxOpened = false;
	};

	this.toggleInbox = function () {
		this.emoticonMenu = false;
		this.inboxOpened = !this.inboxOpened;

		if (this.inboxOpened) {
			bunkerData.markInboxRead()
				.then(function () {
					_.each(self.inbox, function (inboxMessage) {
						inboxMessage.read = true;
					});
					self.unreadInboxMessages = _.select(self.inbox, {read: false}).length;
				});
		}
	};

	this.showHelp = function () {
		$modal.open({
			templateUrl: '/assets/app/help/help.html',
			controller: 'HelpController',
			size: 'lg'
		});
	};

	this.dragRoomListeners = {
		orderChanged: function roomOrderChanged(evt) {
			for (var i = 0; i < self.rooms.length; i++) {
				var room = self.rooms[i];

				// check each membership
				var membership = _.findWhere(self.memberships, {room: room.id});

				membership.roomOrder = i;
			}
			bunkerData.saveRoomMemberSettings(self.memberships);
		}
	};

	this.clearInbox = function () {
		bunkerData.clearInbox();
		self.inboxOpened = false;
	};

	this.goToRoom = function (message) {
		self.inboxOpened = false;

		//check if room still has message loaded
		var room = _.find(bunkerData.rooms, {id: message.room});
{'fraction_non_alphanumeric': 0.14649081488459728, 'fraction_numerical': 0.0004710315591144607, 'mean_word_length': 3.961448598130841, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5815019', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1448, 'n_words': 250}