• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/controller.php
  • Класс: BitrixDiskUfController
  • Вызов: Controller::setAutoCommentToAttachedObject
private function setAutoCommentToAttachedObject($attachedId, $enable)
{
	if($this->errorCollection->hasErrors())
	{
		return false;
	}
	/** @var AttachedObject $attachedModel */
	$attachedModel = AttachedObject::loadById((int)$attachedId);
	if(!$attachedModel)
	{
		$this->errorCollection->add(array(new Error('Could not find attached object')));
		return false;
	}
	if($attachedModel->getCreatedBy() != $this->getUser()->getId())
	{
		$this->errorCollection->add(array(new Error('Could not disable comments to another attached object')));
		return false;
	}

	return $enable? $attachedModel->enableAutoComment() : $attachedModel->disableAutoComment();
}