3declare(strict_types=1);
5namespace Bitrix\Im\V2\Analytics;
7use Bitrix\Disk\Analytics\DiskAnalytics;
8use Bitrix\Disk\Analytics\Enum\ImSection;
10use Bitrix\Im\V2\Analytics\Event\ChatEvent;
12use Bitrix\Im\V2\Chat\CollabChat;
13use Bitrix\Im\V2\Relation\Reason;
14use Bitrix\Main\Loader;
20 protected const JOIN =
'join';
38 $this->
async(
function () {
40 ->createChatEvent(self::SUBMIT_CREATE_NEW)
47 public function addAddUser(Reason $reason = Reason::DEFAULT,
bool $isJoin =
false): void
54 $this->
async(
function () use ($reason, $isJoin) {
57 $eventName = self::JOIN;
61 $eventName = match ($reason) {
62 Reason::STRUCTURE => self::ADD_DEPARTMENT,
63 default => self::ADD_USER,
68 ->createChatEvent($eventName)
82 $this->
async(
function () {
84 ->createChatEvent(self::DELETE_USER)
93 $this->
async(
function () use ($flag) {
95 ->createChatEvent($flag ? self::FOLLOW_COMMENTS : self::UNFOLLOW_COMMENTS)
103 $this->
async(
function () use ($messagesAutoDeleteDelay) {
105 ->createChatEvent(self::AUTODELETE_ON)
107 ->setP3(
'timer_' . $messagesAutoDeleteDelay)
117 $this->
async(
function () {
119 ->createChatEvent(self::AUTODELETE_OFF)
136 $this->
async(
function () use ($eventName) {
138 ->createChatEvent($eventName)
146 $this->
async(
function () {
148 ->createChatEvent(self::EDIT_DESCRIPTION)
179 if (Loader::includeModule(
'disk'))
187 return match ($this->chat->getType())
189 Chat::IM_TYPE_CHANNEL, Chat::IM_TYPE_OPEN_CHANNEL => ImSection::Channel,
190 Chat::IM_TYPE_OPEN_LINE => ImSection::Openline,
191 default => ImSection::Chat
204 return (
new ChatEvent($eventName, $this->chat, $this->userId));
209 $result = self::$oneTimeEvents[$eventName][$this->chat->getId()] ??
true;
210 self::$oneTimeEvents[$eventName][$this->chat->getId()] =
false;
217 if (self::$blockSingleUserEvents ===
true)
224 self::$blockSingleUserEvents =
true;
229 self::$blockSingleUserEvents[
$chat->getId()] =
true;
234 if (is_bool(self::$blockSingleUserEvents))
239 unset(self::$blockSingleUserEvents[
$chat->getId()]);
244 if (!is_array(self::$blockSingleUserEvents))
249 return self::$blockSingleUserEvents[$this->chat->getId()] ??
false;
isChatTypeAllowed(Chat $chat)
getImSectionForDiskEvent()
addAddUser(Reason $reason=Reason::DEFAULT, bool $isJoin=false)
createChatEvent(string $eventName,)
static array bool $blockSingleUserEvents
addChatEditEvent(string $eventName)
addAutoDeleteOn(int $messagesAutoDeleteDelay)
addFollowComments(bool $flag)
isSingleUserEventsBlocked()
static array $oneTimeEvents
static unblockSingleUserEventsByChat(Chat $chat)
addUploadFile(File $file)
static blockSingleUserEvents(?Chat $chat=null)
isFirstTimeEvent(string $eventName)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)