• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat.php
  • Класс: BitrixImV2Chat
  • Вызов: Chat::read
public function read(bool $onlyRecent = false, bool $byEvent = false): Result
{
	ImRecent::unread($this->getDialogId(), false, $this->getContext()->getUserId());

	if ($onlyRecent)
	{
		$lastId = $this->getReadService()->getLastMessageIdInChat($this->chatId);

		return (new Result())->setResult([
			'CHAT_ID' => $this->chatId,
			'LAST_ID' => $lastId,
			'COUNTER' => $this->getReadService()->getCounterService()->getByChat($this->chatId),
			'VIEWED_MESSAGES' => [],
		]);
	}

	return $this->readAllMessages($byEvent);
}