- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/integration/forum/notificationprovider.php
- Класс: BitrixTasksIntegrationForumis
- Вызов: is::onCommentReply
private function onCommentReply(Message $message, string $text): void
{
$task = new CTaskItem($message->getMetaData()->getTask()->getId(), $message->getSender()->getId());
$commentId = CTaskCommentItem::add($task, ['POST_MESSAGE' => $text]);
if (
$commentId > 0
&& BitrixMainLoader::includeModule('socialnetwork')
)
{
$res = BitrixSocialnetworkLogCommentTable::getList(array(
'filter' => array(
'EVENT_ID' => array('crm_activity_add_comment', 'tasks_comment'),
'SOURCE_ID' => $commentId
),
'select' => array('ID', 'LOG_ID')
));
if ($logCommentFields = $res->fetch())
{
$res = BitrixSocialnetworkLogTable::getList(array(
'filter' => array(
"=ID" => $logCommentFields['LOG_ID']
),
'select' => array("ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "SOURCE_ID")
));
if ($logEntry = $res->fetch())
{
$logCommentFields = BitrixSocialnetworkItemLogComment::getById($logCommentFields['ID'])->getFields();
$res = CSite::getByID(SITE_ID);
$site = $res->fetch();
$userPage = Option::get('socialnetwork', 'user_page', $site['DIR'] . 'company/personal/');
$userPath = $userPage.'user/'.$logEntry['USER_ID'].'/';
BitrixSocialnetworkComponentHelper::addLiveComment(
$logCommentFields,
$logEntry,
CSocNetLogTools::findLogCommentEventByLogEventID($logEntry["EVENT_ID"]),
array(
"ACTION" => 'ADD',
"SOURCE_ID" => $logCommentFields['SOURCE_ID'],
"TIME_FORMAT" => CSite::getTimeFormat(),
"PATH_TO_USER" => $userPath,
"NAME_TEMPLATE" => CSite::getNameFormat(null, SITE_ID),
"SHOW_LOGIN" => "N",
"AVATAR_SIZE" => 100,
"LANGUAGE_ID" => $site["LANGUAGE_ID"],
"SITE_ID" => SITE_ID,
"PULL" => "Y",
)
);
}
}
}
}