• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/socialnetwork/log.php
  • Класс: BitrixTasksIntegrationSocialNetworkLog
  • Вызов: Log::onAfterLogFollowSet
static function onAfterLogFollowSet($logId, $type, $userId)
{
	if (!static::includeModule())
	{
		return;
	}

	$taskId = 0;
	$userId = (int)$userId;

	$res = LogTable::getList([
		'select' => ['SOURCE_ID'],
		'filter' => [
			'=ID' => $logId,
			'=EVENT_ID' => 'tasks',
		],
	]);
	if ($data = $res->fetch())
	{
		$taskId = (int)$data['SOURCE_ID'];
	}

	if ($type === 'Y')
	{
		UserOption::delete($taskId, $userId, UserOptionOption::MUTED);
	}
	else
	{
		UserOption::add($taskId, $userId, UserOptionOption::MUTED);
	}
}