• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat/NotifyChat.php
  • Класс: BitrixImV2ChatNotifyChat
  • Вызов: NotifyChat::dropOtherUserNotificationByTag
protected function dropOtherUserNotificationByTag(Message $message): void
{
	if (
		$this->getChatId()
		&& $message->getAuthorId()
		&& $message->getNotifyTag()
	)
	{
		$lastMessages = MessageTable::getList([
			'select' => ['ID', 'AUTHOR_ID'],
			'filter' => [
				'=NOTIFY_TAG' => $message->getNotifyTag(),
				'=CHAT_ID' => $this->getChatId(),
			]
		]);
		$users = [];
		while ($lastMessage = $lastMessages->fetch())
		{
			$lastMessageParams = new Params();
			$lastMessageParams->loadByMessageId($lastMessage['ID']);

			if ($lastMessageParams->isSet(Params::USERS))
			{
				$users = array_merge($users, $lastMessageParams->get(Params::USERS)->getValue());
			}
			$users[] = (int)$lastMessage['AUTHOR_ID'];

			CIMNotify::Delete($lastMessage['ID']);
		}
		$message->getParams()
			->get(Params::USERS)
			->setValue(array_unique($users))
			->unsetValue($message->getAuthorId())
		;
	}
}