• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat/OpenLineChat.php
  • Класс: BitrixImV2ChatOpenLineChat
  • Вызов: OpenLineChat::readAllMessages
public function readAllMessages(bool $byEvent = false, bool $forceRead = false): Result
{
	$result = $this->readMessages(null, $byEvent, $forceRead);

	$userId = $this->getContext()->getUserId();
	Application::getInstance()->addBackgroundJob(function () use ($byEvent, $forceRead, $userId) {
		$chat = $this->withContextUser($userId);

		if ($chat->getSelfRelation() === null)
		{
			$chat->readMessages(null, $byEvent, $forceRead);
		}
	});

	return $result;
}