• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat/PrivateChat.php
  • Класс: BitrixImV2ChatPrivateChat
  • Вызов: PrivateChat::getOpponentId
public function getOpponentId(): int
{
	/** @var Relation $relation */
	$opponentUserId = 0;
	foreach ($this->getRelations() as $relation)
	{
		if (
			User::getInstance($relation->getUserId())->isActive()
			&& $this->getAuthorId() != $relation->getUserId()
		)
		{
			$opponentUserId = $relation->getUserId();
			break;
		}
	}

	return $opponentUserId;
}