- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/file.php
- Класс: BitrixDiskFile
- Вызов: File::commentAttachedObjects
public function commentAttachedObjects(Version $version): void
{
$createdBy = $version->getCreatedBy();
$valueVersionUf = FileUserType::NEW_FILE_PREFIX . $version->getId();
/** @var User $createUser */
$createUser = User::loadById($createdBy);
if (!$createUser)
{
return;
}
$text = $this->getTextForComment($createUser);
$attachedObjects = $this->getAttachedObjects([
'filter' => [
'=ALLOW_AUTO_COMMENT' => 1,
],
]);
foreach ($attachedObjects as $attachedObject)
{
if (!$attachedObject->getAllowAutoComment())
{
continue;
}
AttachedObject::storeDataByObjectId($this->getId(), [
'IS_EDITABLE' => $attachedObject->isEditable(),
'ALLOW_EDIT' => $attachedObject->getAllowEdit(),
'STATE' => 'commentAttachedObjects',
]);
$attachedObject->getConnector()->addComment($createdBy, [
'text' => $text,
'versionId' => $valueVersionUf,
'authorGender' => $createUser->getPersonalGenderExact()
]);
AttachedObject::storeDataByObjectId($this->getId(), null);
}
}