1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
AutoJoinToChat.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller\Filter;
4
5
use Bitrix\Im\V2\Chat;
6
use Bitrix\Im\V2\Message;
7
use Bitrix\Main\Engine\ActionFilter\Base;
8
use Bitrix\Main\Event;
9
10
class
AutoJoinToChat
extends
Base
11
{
12
public
function
onBeforeAction
(
Event
$event
)
13
{
14
$chat = $this->getChat();
15
if
($chat ===
null
)
16
{
17
return
null
;
18
}
19
20
if
(!$chat->canUserAutoJoin())
21
{
22
return
null
;
23
}
24
25
$chat->join(
false
);
26
}
27
28
private
function
getChat(): ?
Chat
29
{
30
$chat = $this->
getAction
()->getArguments()[
'chat'
] ??
null
;
31
32
if
($chat instanceof
Chat
)
33
{
34
return
$chat;
35
}
36
37
$message
= $this->
getAction
()->getArguments()[
'message'
] ??
null
;
38
if
(
$message
instanceof
Message
)
39
{
40
return
$message
->getChat();
41
}
42
43
return
null
;
44
}
45
}
Bitrix\Im\V2\Controller\Filter\AutoJoinToChat
Определения
AutoJoinToChat.php:11
Bitrix\Im\V2\Controller\Filter\AutoJoinToChat\onBeforeAction
onBeforeAction(Event $event)
Определения
AutoJoinToChat.php:12
Bitrix\Main\Engine\ActionFilter\Base
Определения
base.php:15
Bitrix\Main\Engine\ActionFilter\Base\getAction
getAction()
Определения
base.php:48
Bitrix\Im\Message
Определения
Uuid.php:3
Bitrix\Im\V2\Chat\ExternalChat\Event
Определения
AfterCreateEvent.php:3
Bitrix\Im\V2\Chat
$message
$message
Определения
payment.php:8
$event
$event
Определения
prolog_after.php:141
bitrix
modules
im
lib
V2
Controller
Filter
AutoJoinToChat.php
Создано системой
1.14.0