• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat.php
  • Класс: BitrixImV2Chat
  • Вызов: Chat::hideChat
private function hideChat(): Result
{
	$result = new Result();

	if (!$this->getChatId())
	{
		return $result->addError(new ChatError(ChatError::NOT_FOUND));
	}

	$pushList = [];
	foreach($this->getRelations() as $relation)
	{
		CIMContactList::DeleteRecent($this->getChatId(), true, $relation->getUserId());

		if (!ImUser::getInstance($relation->getUserId())->isConnector())
		{
			$pushList[] = $relation->getUserId();
		}
	}

	if (
		!empty($pushList)
		&& BitrixMainLoader::includeModule("pull")
	)
	{
		BitrixPullEvent::add($pushList, [
			'module_id' => 'im',
			'command' => 'chatHide',
			'expiry' => 3600,
			'params' => [
				'dialogId' => 'chat' . $this->getChatId(),
			],
			'extra' => BitrixImCommon::getPullExtra()
		]);
	}

	return $result;
}