1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
OpenChat.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Chat;
4
5use Bitrix\Im\V2\Entity\User\User;
6use Bitrix\Im\V2\Relation\DeleteUserConfig;
7use Bitrix\Im\V2\Result;
8use Bitrix\Main\Loader;
9use CIMContactList;
10
11class OpenChat extends GroupChat
12{
13 protected function getDefaultType(): string
14 {
15 return self::IM_TYPE_OPEN;
16 }
17
18 protected function checkAccessInternal(int $userId): Result
19 {
20 if (User::getInstance($userId)->isExtranet())
21 {
22 return parent::checkAccessInternal($userId);
23 }
24
25 return new Result();
26 }
27
29 {
30 return [];
31 }
32
33 public function filterUsersToMention(array $userIds): array
34 {
35 $result = [];
36 $relations = $this->getRelationsByUserIds($userIds);
37
38 foreach ($userIds as $userId)
39 {
40 $relation = $relations->getByUserId($userId, $this->getChatId());
41 if (
42 ($relation === null
43 || $relation->getNotifyBlock())
45 )
46 {
48 }
49 }
50
51 return $result;
52 }
53
54 protected function getAccessCodesForDiskFolder(): array
55 {
56 $accessCodes = parent::getAccessCodesForDiskFolder();
57 $departmentCode = \CIMDisk::GetTopDepartmentCode();
58
59 if ($departmentCode)
60 {
61 $driver = \Bitrix\Disk\Driver::getInstance();
62 $rightsManager = $driver->getRightsManager();
63 $accessCodes[] = [
64 'ACCESS_CODE' => $departmentCode,
65 'TASK_ID' => $rightsManager->getTaskIdByName($rightsManager::TASK_READ)
66 ];
67 }
68
69 return $accessCodes;
70 }
71
72 public function extendPullWatch(): void
73 {
74 if (Loader::includeModule('pull'))
75 {
76 \CPullWatch::Add($this->getContext()->getUserId(), "IM_PUBLIC_{$this->getId()}", true);
77 }
78 }
79
80 public function needToSendPublicPull(): bool
81 {
82 return true;
83 }
84
85 protected function updateStateAfterRelationsAdd(array $usersToAdd): self
86 {
87 parent::updateStateAfterRelationsAdd($usersToAdd);
88
89 if (Loader::includeModule('pull'))
90 {
91 foreach ($usersToAdd as $userId)
92 {
93 \CPullWatch::Delete($userId, 'IM_PUBLIC_' . $this->getId());
94 }
95 }
96
97 $this->clearAllLegacyCache();
98
99 return $this;
100 }
101
102 protected function updateStateAfterUserDelete(int $deletedUserId, DeleteUserConfig $config): self
103 {
104 parent::updateStateAfterUserDelete($deletedUserId, $config);
105 $this->clearAllLegacyCache();
106
107 return $this;
108 }
109
110 protected function clearLegacyCache(int $userId): void
111 {
112 return;
113 }
114
115 protected function clearAllLegacyCache()
116 {
117 CIMContactList::CleanAllChatCache();
118 }
119
120 protected function needToSendMessageUserDelete(): bool
121 {
122 return false;
123 }
124}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
checkAccessInternal(int $userId)
Определения OpenChat.php:18
getRecentSectionsForGuest()
Определения OpenChat.php:28
clearLegacyCache(int $userId)
Определения OpenChat.php:110
getDefaultType()
Определения OpenChat.php:13
updateStateAfterRelationsAdd(array $usersToAdd)
Определения OpenChat.php:85
needToSendMessageUserDelete()
Определения OpenChat.php:120
getAccessCodesForDiskFolder()
Определения OpenChat.php:54
clearAllLegacyCache()
Определения OpenChat.php:115
extendPullWatch()
Определения OpenChat.php:72
needToSendPublicPull()
Определения OpenChat.php:80
updateStateAfterUserDelete(int $deletedUserId, DeleteUserConfig $config)
Определения OpenChat.php:102
filterUsersToMention(array $userIds)
Определения OpenChat.php:33
static getInstance()
Определения application.php:98
Определения result.php:20
static GetTopDepartmentCode()
Определения im_disk.php:2502
static GetNotifyAccess($userId, $moduleId, $eventId, $clientId)
Определения im_settings.php:255
const CLIENT_SITE
Определения im_settings.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$config
Определения quickway.php:69