3declare(strict_types=1);
5namespace Bitrix\Socialnetwork\Collab\Converter\Handler;
9use Bitrix\Socialnetwork\Collab\Converter\Command\AbstractConverterCommand;
10use Bitrix\Socialnetwork\Collab\Integration\IM\ChatType;
11use Bitrix\Socialnetwork\Collab\Integration\IM\Messenger;
12use Bitrix\Socialnetwork\Integration\Im\ChatFactory;
13use Bitrix\Socialnetwork\Internals\Registry\GroupRegistry;
14use Bitrix\Socialnetwork\Item\Workgroup;
15use Bitrix\Socialnetwork\Item\Workgroup\Type;
22 $group = GroupRegistry::getInstance()->get($command->getGroup()->getId());
24 $type = $group->getType();
25 $chatId = $group->getChatId();
29 return $result->addError(
new Error(
'Incorrect group type'));
34 return $result->addError(
new Error(
'Group has no chat'));
37 $fields = $this->prepareChatFields($group);
38 $updateService = Messenger::getUpdateService($group->getChatId(),
$fields);
42 return $result->addError(
new Error(
'Chat update service not found'));
45 $chatUpdateResult = $updateService->updateChat();
47 if (!$chatUpdateResult->isSuccess())
49 return $result->addErrors($chatUpdateResult->getErrors());
57 $type = $group->getType();
59 $fields[
'TITLE'] = ChatFactory::getChatTitle($group->getName(),
$type);
execute(AbstractConverterCommand $command)
static getChatTypeByGroupType(Type $type)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)