- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat.php
- Класс: BitrixImV2Chat
- Вызов: Chat::sendPushUnreadOpponent
protected function sendPushUnreadOpponent(string $chatMessageStatus, int $unreadTo, ?array $lastMessageStatuses): void
{
$pushMessage = [
'module_id' => 'im',
'command' => 'unreadMessageChatOpponent',
'expiry' => 600,
'params' => [
'dialogId' => $this->getDialogId(),
'chatId' => $this->chatId,
'userId' => $this->getContext()->getUserId(),
'chatMessageStatus' => $chatMessageStatus,
'unreadTo' => $unreadTo,
'lastMessageStatuses' => $lastMessageStatuses ?? [],
],
'extra' => BitrixImCommon::getPullExtra()
];
$viewsByGroups = $this->getLastMessageViewsByGroups();
foreach ($viewsByGroups as $view)
{
$pushMessage['params']['lastMessageViews'] = ImCommon::toJson($view['VIEW_INFO']);
$usersForPush = $this->getUsersForPush();
$recipient = array_intersect($usersForPush, $view['USERS']);
BitrixPullEvent::add($recipient, $pushMessage);
}
}