- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/recent.php
- Класс: BitrixImRecent
- Вызов: Recent::getUnread
static function getUnread(string $itemType, string $dialogId): array
{
$id = mb_strpos($dialogId, 'chat') === 0 ? mb_substr($dialogId, 4) : $dialogId;
$queryResult = BitrixImModelRecentTable::getList([
'select' => ['USER_ID', 'UNREAD',],
'filter' => [
'=ITEM_TYPE' => $itemType,
'=ITEM_ID' => $id
]
])->fetchAll();
$result = [];
foreach ($queryResult as $row)
{
$result[(int)$row['USER_ID']] = ($row['UNREAD'] ?? 'N') === 'Y';
}
return $result;
}