1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Comment.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Controller\Chat;
4
5use Bitrix\Im\V2\Analytics\ChatAnalytics;
6use Bitrix\Im\V2\Chat;
7use Bitrix\Im\V2\Controller\BaseController;
8use Bitrix\Im\V2\Controller\Filter\ChatTypeFilter;
9
11{
12 public function configureActions()
13 {
14 $config = parent::configureActions();
15
16 $config['subscribe'] = [
17 '+prefilters' => [
18 new ChatTypeFilter([Chat\CommentChat::class]),
19 ],
20 ];
21 $config['unsubscribe'] = [
22 '+prefilters' => [
23 new ChatTypeFilter([Chat\CommentChat::class]),
24 ],
25 ];
26 $config['readAll'] = [
27 '+prefilters' => [
28 new ChatTypeFilter([Chat\ChannelChat::class]),
29 ],
30 ];
31
32 return $config;
33 }
34
38 public function subscribeAction(Chat\CommentChat $chat): ?array
39 {
40 return $this->subscribe($chat, true);
41 }
42
46 public function unsubscribeAction(Chat\CommentChat $chat): ?array
47 {
48 return $this->subscribe($chat, false);
49 }
50
54 public function readAllAction(Chat\ChannelChat $chat): ?array
55 {
56 $chat->realAllComments();
57
58 return ['result' => true];
59 }
60
61 protected function subscribe(Chat\CommentChat $chat, bool $flag): ?array
62 {
63 $result = $chat->subscribe($flag);
64
65 if (!$result->isSuccess())
66 {
67 $this->addErrors($result->getErrors());
68
69 return null;
70 }
71
72 (new ChatAnalytics($chat))->addFollowComments($flag);
73
74 return ['result' => true];
75 }
76}
subscribe(Chat\CommentChat $chat, bool $flag)
Определения Comment.php:61
unsubscribeAction(Chat\CommentChat $chat)
Определения Comment.php:46
subscribeAction(Chat\CommentChat $chat)
Определения Comment.php:38
readAllAction(Chat\ChannelChat $chat)
Определения Comment.php:54
</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