• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/Delete/DeleteService.php
  • Класс: BitrixImV2MessageDeleteDeleteService
  • Вызов: DeleteService::groupPullByCounter
private function groupPullByCounter(array $pullMessage, bool $completeDelete): array
{
	$events = [];
	/** @var Relation $relation */
	$relations = $this->chat->getRelations();
	$unreadList = Recent::getUnread($this->chat->getType(), $this->chat->getDialogId());
	foreach ($relations as $relation)
	{
		$user = $relation->getUser();
		if (
			(!$user->isActive() && $user->getExternalAuthId() !== BitrixImBot::EXTERNAL_AUTH_ID)
			|| ($this->chat->getEntityType() === Chat::ENTITY_TYPE_LINE && $user->getExternalAuthId() === 'imconnector')
		)
		{
			continue;
		}

		$userId = $relation->getUserId();

		$pullMessage['params']['unread'] = $unreadList[$userId] ?? false;
		$pullMessage['params']['muted'] = $relation->getNotifyBlock() ?? false;

		$events[$userId] = $pullMessage;

		$count = 0;
		if ($this->needUpdateRecent && $completeDelete)
		{
			$lastMessageViews = $this->getLastViewers($userId);
			$events[$userId]['params']['lastMessageViews'] = $lastMessageViews;
			$count = $lastMessageViews['countOfViewers'] ?? 0;
		}

		$unreadGroupFlag = $pullMessage['params']['unread'] ? 1 : 0;
		$mutedGroupFlag = $pullMessage['params']['muted'] ? 1 : 0;

		$events[$userId]['params']['counter'] = $this->getCounter($userId);
		$events[$userId]['groupId'] =
			'im_chat_'
			. $this->chat->getChatId()
			. '_'. $this->message->getMessageId()
			. '_'. $events[$userId]['params']['counter']
			. '_'. $count
			. '_'. $unreadGroupFlag
			. '_'. $mutedGroupFlag
		;
	}

	return (new MessageSendPushService())->getEventByCounterGroup($events);
}