• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/forum/task/comment.php
  • Класс: BitrixTasksIntegrationForumTaskComment
  • Вызов: Comment::onPrepareComments
static function onPrepareComments($component)
{
	if(CommentsViewedGroup::isOn())
	{
		$arResult =& $component->arResult;
		$arParams =& $component->arParams;

		$arMessages = &$arResult['MESSAGES'];

		$template = $arParams['TEMPLATE_DATA'] ?? [];
		$data = $template['DATA'] ?? [];
		$viewed = $data['GROUP_VIEWED'] ?? [];
		$unRead = $viewed['UNREAD_MID'] ?? [];

		$component = CBitrixComponent::includeComponentClass('bitrix:forum.comments');
		/** @var ForumCommentsComponent $component */

		foreach ($arMessages as $messageId => $messageFields)
		{
			$arResult['MESSAGES'][$messageId]['NEW'] = in_array($messageId, $unRead) ? $component::MID_NEW : $component::MID_OLD;
			// $arResult['MESSAGES'][$messageId]['NEW'] = $component::MID_NEW;
		}
	}
}