76 if ($this->postTypeListInited ===
false)
78 $moduleEvent = new \Bitrix\Main\Event(
80 'onCommentAuxGetPostTypeList',
85 foreach ($moduleEvent->getResults() as $moduleEventResult)
87 if ($moduleEventResult->getType() === \
Bitrix\Main\EventResult::SUCCESS)
89 $moduleEventParams = $moduleEventResult->getParameters();
92 is_array($moduleEventParams)
93 && !empty($moduleEventParams[
'typeList'])
94 && is_array($moduleEventParams[
'typeList'])
97 foreach ($moduleEventParams[
'typeList'] as $type)
105 $this->postTypeListInited =
true;
113 if ($this->commentTypeListInited ===
false)
115 $moduleEvent = new \Bitrix\Main\Event(
117 'onCommentAuxGetCommentTypeList',
120 $moduleEvent->send();
122 foreach ($moduleEvent->getResults() as $moduleEventResult)
124 if ($moduleEventResult->getType() === \
Bitrix\Main\EventResult::SUCCESS)
126 $moduleEventParams = $moduleEventResult->getParameters();
129 is_array($moduleEventParams)
130 && !empty($moduleEventParams[
'typeList'])
131 && is_array($moduleEventParams[
'typeList'])
134 foreach($moduleEventParams[
'typeList'] as $type)
142 $this->commentTypeListInited =
true;
172 if (!empty($fields[
'SHARE_DEST']))
177 isset($fields[
'RATING_TYPE_ID'], $fields[
'SOURCE_ID'])
178 && (
int)$fields[
'SOURCE_ID'] > 0
179 && in_array($fields[
'RATING_TYPE_ID'], [
'FORUM_POST',
'CRM_ENTITY_COMMENT' ])
180 && Loader::includeModule(
'forum')
183 $messageId = (int)$fields[
'SOURCE_ID'];
185 $forumPostLivefeedProvider = new \Bitrix\Socialnetwork\Livefeed\ForumPost();
186 $commentData = $forumPostLivefeedProvider->getAuxCommentCachedData($messageId);
192 && !empty($serviceData)
193 && isset($commentData[
'SERVICE_TYPE'])
194 && $commentData[
'SERVICE_TYPE'] === $this->
getForumType()
199 $messageParams = Json::decode($serviceData);
210 $res = MessageTable::getList([
212 '=ID' => (
int)$fields[
'SOURCE_ID']
217 if ($forumMessageFields = $res->fetch())
220 if (!empty($serviceData))
224 $messageParams = Json::decode($serviceData);
437 $entityType =
$params[
'entityType'] ??
null;
438 $entityId = (int) (
$params[
'entityId'] ??
null);
441 $permissionCacheKey = ($checkPermissions ?
'Y' :
'N');
442 $entityKey = $entityType .
'_' . $entityId;
444 if (isset($cache[$permissionCacheKey][$entityKey]))
446 $result = $cache[$permissionCacheKey][$entityKey];
454 case static::ENTITY_TYPE_TASK:
455 $provider = new \Bitrix\Socialnetwork\Livefeed\TasksTask();
457 case static::ENTITY_TYPE_BLOG_POST:
458 $provider = new \Bitrix\Socialnetwork\Livefeed\BlogPost();
460 case static::ENTITY_TYPE_CALENDAR_EVENT:
461 $provider = new \Bitrix\Socialnetwork\Livefeed\CalendarEvent();
469 $provider->setEntityId($entityId);
470 $provider->setOption(
'checkAccess', $checkPermissions);
473 'title' => $provider->getSourceTitle(),
474 'url' => $provider->getLiveFeedUrl(),
480 $result = $cache[$permissionCacheKey][$entityKey] = $entity;
482 elseif(!$checkPermissions)
484 $result = $cache[$permissionCacheKey][$entityKey] =
false;
547 $userPage = ($additionalParams[
'userPage'] ??
'');
552 $params[
'sourceType'] === static::SOURCE_TYPE_BLOG_COMMENT
553 && Loader::includeModule(
'blog')
554 && ($comment = static::$blogCommentClass::getById(
$params[
'sourceId']))
555 && ($post = static::$blogPostClass::getById($comment[
'POST_ID']))
562 ? str_replace([
'#user_id#',
'#USER_ID#' ], $post[
'AUTHOR_ID'], $userPage) .
'blog/' . $post[
'ID'] .
'/?commentId=' .
$params[
'sourceId'] .
'#com' .
$params[
'sourceId']
568 $commentProvider = \Bitrix\Socialnetwork\Livefeed\Provider::getProvider(
$params[
'sourceType']);
579 $commentProvider->setEntityId((
int)
$params[
'sourceId']);
580 $commentProvider->setLogId(
$options[
'logId']);
581 $commentProvider->initSourceFields();
583 $result[
'path'] = $commentProvider->getLiveFeedUrl();
587 $result[
'suffix'] = (
$options[
'suffix'] ?? (
$params[
'sourceType'] === static::SOURCE_TYPE_BLOG_COMMENT ?
'2' :
''));