<commit_before>﻿'use strict';

window.chatApp.controllers.ChatController = function ($routeParams, $timeout)
{
	var vm = this,
		chatRsn = $routeParams.chatRsn;

	vm.messages = [];
	vm.cardAnimationClass = '.card-animation';
	vm.ConversationName = "";
	vm.comment = "";

	window.cqrsNotificationHub
		.GlobalEventHandlers["Chat.MicroServices.Conversations.Events.CommentPosted"] =
		function (event)
		{
			if (event.Data.ConversationRsn == chatRsn)
			{
				vm.messages.push
				(
					{
						"Rsn": event.Data.Rsn,
						"ConversationRsn": event.Data.ConversationRsn,
						"ConversationName": event.Data.ConversationName,
						"UserRsn": event.Data.UserRsn,
						"UserName": event.Data.UserName,
						"Content": event.Data.Comment,
						"DatePosted": event.Data.DatePosted
					}
				);
			}
		}

	vm.formatContent = function (content)
	{
		return content.replace(/\r\n/g, '<br />\r\n');
	}

	vm.postReply = function ()
	{
		window.api.Conversations
			.PostComment({ "conversationRsn": chatRsn, "comment": vm.comment })
			.done
			(
				function (result, textStatus, jqXHR)
				{
					vm.comment = "";
				}
			)
			.fail
			(
				function (jqXHR, textStatus, errorThrown)
				{
					console.error(textStatus, errorThrown);
				}
			);
	}

	function getMessages()
	{
		window.api.Conversations<commit_msg>#39 Fixed a refresh issue post event.<commit_after>﻿'use strict';

window.chatApp.controllers.ChatController = function ($scope, $routeParams, $timeout)
{
	var vm = this,
		chatRsn = $routeParams.chatRsn;

	vm.messages = [];
	vm.cardAnimationClass = '.card-animation';
	vm.ConversationName = "";
	vm.comment = "";

	window.cqrsNotificationHub
		.GlobalEventHandlers["Chat.MicroServices.Conversations.Events.CommentPosted"] =
		function (event)
		{
			if (event.Data.ConversationRsn == chatRsn)
			{
				vm.messages.push
				(
					{
						"Rsn": event.Data.Rsn,
						"ConversationRsn": event.Data.ConversationRsn,
						"ConversationName": event.Data.ConversationName,
						"UserRsn": event.Data.UserRsn,
						"UserName": event.Data.UserName,
						"Content": event.Data.Comment,
						"DatePosted": event.Data.DatePosted
					}
				);
				$scope.$apply();
			}
		}

	vm.formatContent = function (content)
	{
		return content.replace(/\r\n/g, '<br />\r\n');
	}

	vm.postReply = function ()
	{
		window.api.Conversations
			.PostComment({ "conversationRsn": chatRsn, "comment": vm.comment })
			.done
			(
				function (result, textStatus, jqXHR)
				{
					vm.comment = "";
				}
			)
			.fail
			(
				function (jqXHR, textStatus, errorThrown)
				{
					console.error(textStatus, errorThrown);
				}
			);
	}

	function getMessages()
	{
		window.api.Conversations
{'fraction_non_alphanumeric': 0.1475959746552367, 'fraction_numerical': 0.0007454342154304882, 'mean_word_length': 3.0239880059970017, 'pattern_counts': {'":': 18, '<': 5, '<?xml version=': 0, '>': 5, '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': '6803799', 'n_tokens_mistral': 1173, 'n_tokens_neox': 937, 'n_words': 145}