3declare(strict_types=1);
5namespace Bitrix\Socialnetwork\Collab\Control\Handler\Add;
7use Bitrix\Socialnetwork\Collab\Integration\IM\ActionMessageBuffer;
8use Bitrix\Socialnetwork\Control\Member\Trait\AddMemberTrait;
9use Bitrix\Socialnetwork\Collab\Integration\IM\ActionType;
10use Bitrix\Socialnetwork\Collab\Integration\IM\ActionMessageFactory;
11use Bitrix\Socialnetwork\Collab\Integration\IM\Messenger;
12use Bitrix\Socialnetwork\Control\Command\AddCommand;
13use Bitrix\Socialnetwork\Control\Handler\Add\AddHandlerInterface;
14use Bitrix\Socialnetwork\Control\Handler\HandlerResult;
15use Bitrix\Socialnetwork\Control\Member\Trait\GetMembersTrait;
16use Bitrix\Socialnetwork\Integration\HumanResources\AccessCodeConverter;
17use Bitrix\Socialnetwork\Item\Workgroup;
18use Bitrix\Socialnetwork\UserToGroupTable;
29 $moderators = $command->getModeratorMembers();
30 if (empty($moderators))
32 return $handlerResult;
39 $add = array_diff($membersByCommand, $this->getMemberIds(
$entity->getId()));
41 $handlerResult = $this->addMembers(
43 $command->getInitiatorId(),
49 if (!$handlerResult->isSuccess())
51 return $handlerResult;
54 ActionMessageBuffer::getInstance()
55 ->put(ActionType::AddUser,
$entity->getId(), $command->getInitiatorId(), $add)
58 Messenger::setManagers(
$entity->getId(), $add);
60 return $handlerResult;
add(AddCommand $command, Workgroup $entity)