27 public function send(array $pushList, array $notVisibleGroupsUsers): void
31 || !Loader::includeModule(
'pull')
38 foreach ($pushList as $push)
43 $tagList = array_unique($tagList);
45 $query = \Bitrix\Pull\Model\WatchTable::query();
46 $query->addSelect(
'USER_ID');
47 $query->addSelect(
'TAG');
48 $query->whereIn(
'TAG', $tagList);
49 $records = $query->fetchAll();
51 $subscribedUsers = [];
52 foreach ($records as $record)
59 $groupId = (int)$matches[1];
61 if (!isset($subscribedUsers[$groupId]))
63 $subscribedUsers[$groupId] = [];
66 $subscribedUsers[$groupId][] = (int)$record[
'USER_ID'];
69 foreach ($pushList as $push)
72 $groupId = (int)$push[
'GROUP_ID'];
73 $userId = (int)$push[
'USER_ID'];
74 $role = (int)$push[
'ROLE'];
77 'module_id' =>
'socialnetwork',
78 'command' => $pushCommand,
79 'params' => [
'GROUP_ID' => $groupId ],
84 $recipients = [ $userId ];
86 elseif (!empty($subscribedUsers[$groupId]))
89 isset($notVisibleGroupsUsers[$groupId])
90 ? array_intersect($subscribedUsers[$groupId], $notVisibleGroupsUsers[$groupId])
91 : $subscribedUsers[$groupId]