• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/recent.php
  • Класс: BitrixImRecent
  • Вызов: Recent::fillCounters
static function fillCounters(array $rows, int $userId): array
{
	$chatIds = [];

	foreach ($rows as $row)
	{
		$chatIds[] = (int)$row['CHAT_ID'];
	}

	$counters = (new CounterService($userId))->getForEachChat($chatIds);

	foreach ($rows as $key => $row)
	{
		$rows[$key]['COUNTER'] = (int)($counters[(int)$row['CHAT_ID']] ?? 0);
	}

	return $rows;
}