<commit_before>require! {
	'../../auth': authorize
	'../../../utils/streaming': Streamer
	'../../../models/talk-message': TalkMessage
	'../../../utils/filter-talk-message-for-response'
}
exports = (req, res) -> authorize req, res, (user, app) ->
	| !(text = req.body.text)? => res.api-error 400 'text parameter is required :('
	| !(message-id = req.body.message_id)? => res.api-error 400 'message_id parameter is required :('
	| _ => TalkMessage.find-by-id message-id, (, talk-message) ->
		| !talk-message? => res.api-error 400 'Message not found'
		| talk-message.user-id != user.id => res.api-error 400 'Message that you have sent only can not be modified.'
		| talk-message.is-deleted => res.api-error 400 'This message has already been deleted.'
		| _ => talk-message.update
			..text = text
			..is-modified = true
			..save ->
				filter-talk-message-for-response talk-message, (obj) ->
					res.api-render obj
					Streamer
						..publish \talkStream: + talk-message.otherparty-id + \- + user.id, JSON.stringify do
							type: \otherpartyMessageUpdate
							value: obj
						..publish \talkStream: + user.id + \- + talk-message.otherparty-id, JSON.stringify do
							type: \meMessageUpdate
							value: obj<commit_msg>Fix bug<commit_after>require! {
	'../../auth': authorize
	'../../../utils/streaming': Streamer
	'../../../models/talk-message': TalkMessage
	'../../../models/utils/filter-talk-message-for-response'
}

exports = (req, res) -> authorize req, res, (user,) ->
	| !(text = req.body.text)? => res.api-error 400 'text parameter is required :('
	| !(message-id = req.body.message_id)? => res.api-error 400 'message_id parameter is required :('
	| _ => TalkMessage.find-by-id message-id, (, talk-message) ->
		| !talk-message? => res.api-error 400 'Message not found'
		| talk-message.user-id != user.id => res.api-error 400 'Message that you have sent only can not be modified.'
		| talk-message.is-deleted => res.api-error 400 'This message has already been deleted.'
		| _ => talk-message
			..text = text
			..is-modified = true
			..save ->
				obj <- filter-talk-message-for-response talk-message
				res.api-render obj
				Streamer
					..publish "talkStream:#{talk-message.otherparty-id}-#{user.id}" JSON.stringify do
						type: \otherpartyMessageUpdate
						value: obj
					..publish "talkStream:#{user.id}-#{talk-message.otherparty-id}" JSON.stringify do
						type: \meMessageUpdate
						value: obj
{'fraction_non_alphanumeric': 0.17871815940838126, 'fraction_numerical': 0.012325390304026294, 'mean_word_length': 2.8528481012658227, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 26, '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': '2453837', 'n_tokens_mistral': 906, 'n_tokens_neox': 771, 'n_words': 187}