• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/controller/comment.php
  • Класс: BitrixRpaControllerComment
  • Вызов: Comment::getVisualEditorAction
public function getVisualEditorAction(string $name, int $commentId = 0): ?Component
{
	$text = '';
	if($commentId > 0)
	{
		$timeline = TimelineTable::getById($commentId)->fetchObject();
		if(!$timeline)
		{
			$this->addError(new Error('Comment ',$commentId.' is not found'));
			return null;
		}
		$item = $timeline->getItem();
		if (!$item)
		{
			$this->addError(new Error('Comment ',$commentId.' is not found'));
			return null;
		}
		$userPermissions = Driver::getInstance()->getUserPermissions();
		if (!$userPermissions->canViewComment($item, $timeline))
		{
			$this->addError(new Error(Loc::getMessage('RPA_MODIFY_COMMENT_ACCESS_DENIED')));
			return null;
		}
		$text = $timeline->getDescription();
	}

	return static::getUiComment()->getVisualEditorResponse($name, $commentId, $text);
}