• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Import/ImportService.php
  • Класс: BitrixImV2ImportImportService
  • Вызов: ImportService::commitCommon
private function commitCommon(array $users, string $clientId, array $finishEntityData = []): Result
{
	$result = new Result();
	$chatId = (int)$this->chat['ID'];

	$users = array_map('intval', $users);
	$folderMembers = $users;
	if (!in_array($this->userId, $users, true))
	{
		CIMDisk::ChangeFolderMembers($chatId, $this->userId, false);
	}
	else
	{
		foreach ($folderMembers as $index => $folderMember)
		{
			if ($folderMember === $this->userId)
			{
				unset($folderMembers[$index]);
			}
		}
	}

	$this->fillChatActualData();
	$this->addUsersInChat($this->chat, $users);
	CIMDisk::ChangeFolderMembers($chatId, $users);
	ChatTable::update(
		$chatId,
		[
			'ENTITY_TYPE' => $finishEntityData['ENTITY_TYPE'] ?? null,
			'ENTITY_ID' => $finishEntityData['ENTITY_ID'] ?? null,
			'ENTITY_DATA_1' => $finishEntityData['ENTITY_DATA_1'] ?? null,
			'USER_COUNT' => count($users),
			'MESSAGE_COUNT' => $this->chat['MESSAGE_COUNT'],
			'LAST_MESSAGE_ID' => $this->chat['LAST_MESSAGE_ID'],
			'PREV_MESSAGE_ID' => $this->chat['PREV_MESSAGE_ID'],
		]
	);
	$this->showInRecent($this->chat);
	$this->sendFinishMessage($users, $clientId);

	return $result;
}