• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/scrum/controllers/calendar.php
  • Класс: BitrixTasksScrumControllersCalendar
  • Вызов: Calendar::getEventChats
private function getEventChats(int $userId, array $listEvents): array
{
	$userService = new UserService();

	$chats = [];

	foreach ($listEvents as $event)
	{
		$chatId = CIMChat::getEntityChat('CALENDAR', $event['id']);
		if ($chatId === false)
		{
			continue;
		}

		$chatData = CIMChat::getChatData(['ID' => $chatId, 'PHOTO_SIZE' => 32]);

		if (($chatData['chat'][$chatId]['avatar'] ?? null) === '/bitrix/js/im/images/blank.gif')
		{
			$chatData['chat'][$chatId]['avatar'] = '';
		}

		$userIds = $chatData['userInChat'][$chatId] ?? null;
		if (is_array($userIds))
		{
			$usersInfo = $userService->getInfoAboutUsers($userIds);
			$users = (count($userIds) > 1 ? array_values($usersInfo) : [$usersInfo]);

			$chats[] = [
				'id' => $chatData['chat'][$chatId]['id'],
				'type' => $chatData['chat'][$chatId]['type'],
				'icon' => $chatData['chat'][$chatId]['avatar'],
				'name' => $chatData['chat'][$chatId]['name'],
				'users' => $users,
			];
		}
	}

	return $chats;
}