• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/rest.php
  • Класс: CSocNetLogRestService
  • Вызов: CSocNetLogRestService::deleteLogComment
static function deleteLogComment($arFields): bool
{
	$commentId = (int)$arFields['COMMENT_ID'];

	if ($commentId <= 0)
	{
		throw new ArgumentException('Wrong comment ID');
	}

	$currentUserId = (
		isset($arFields["USER_ID"])
		&& (int)$arFields["USER_ID"] > 0
		&& self::isAdmin()
			? $arFields["USER_ID"]
			: self::getCurrentUserId()
	);

	$commentFields = BitrixSocialnetworkItemLogComment::getById($commentId)->getFields();
	if (empty($commentFields))
	{
		throw new ObjectNotFoundException('No comment found');
	}

	$currentUserPerm = self::getLogCommentPerm(array(
		'USER_ID' => $currentUserId,
		'COMMENT_ID' => $commentId
	));

	if ($currentUserPerm < self::PERM_WRITE)
	{
		throw new AccessDeniedException('No write perms');
	}

	$result = CSocNetLogComments::Delete($commentId);

	return (bool)$result;
}