• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/forum/task/comment.php
  • Класс: BitrixTasksIntegrationForumTaskComment
  • Вызов: Comment::addToAuditor
static function addToAuditor(int $authorId, int $taskId)
{
	$task = CTaskItem::getInstance($taskId, User::getAdminId());
	try
	{
		$taskData = $task->getData(false);
		if (
			$authorId === (int)$taskData['CREATED_BY']
			|| $authorId === (int)$taskData['RESPONSIBLE_ID']
			|| in_array($authorId, $taskData['ACCOMPLICES'])
			|| in_array($authorId, $taskData['AUDITORS'])
		)
		{
			return;
		}
		$auditors = array_merge($taskData['AUDITORS'], [$authorId]);
		$task->update(['AUDITORS' => $auditors], ['SKIP_ACCESS_CONTROL' => true, 'FIELDS_FOR_COMMENTS' => []]);
	}
	catch (TasksException $e)
	{
		return;
	}
}