19 static $cacheData = [];
23 if (!empty($fields[
'SHARE_DEST']))
25 $paramsList = unserialize(htmlspecialcharsback($fields[
'SHARE_DEST']), [
'allowed_classes' =>
false ]);
26 if (!empty($paramsList))
32 $paramsList = explode(
'|', $fields[
'SHARE_DEST']);
33 if (!empty($paramsList))
35 foreach ($paramsList as $pair)
37 [ $key, $value ] = explode(
'=', $pair);
38 if (isset($key, $value))
47 !empty($fields[
'EVENT_ID'])
48 && in_array($fields[
'EVENT_ID'], [
'tasks_comment',
'crm_activity_add_comment' ])
49 && !empty($fields[
'SOURCE_ID'])
50 && (
int)$fields[
'SOURCE_ID'] > 0
51 && Loader::includeModule(
'forum')
54 $messageId = (int)$fields[
'SOURCE_ID'];
56 if (isset($cacheData[$messageId]))
58 $params = $cacheData[$messageId];
62 $forumPostLivefeedProvider = new \Bitrix\Socialnetwork\Livefeed\ForumPost();
63 $commentData = $forumPostLivefeedProvider->getAuxCommentCachedData($messageId);
67 && isset($commentData[
'SERVICE_TYPE'])
70 !empty($commentData[
'SERVICE_DATA'])
71 || !empty($commentData[
'POST_MESSAGE'])
77 $messageParams = Json::decode(!empty($commentData[
'SERVICE_DATA']) ? $commentData[
'SERVICE_DATA'] : $commentData[
'POST_MESSAGE']);
78 if (!is_array($messageParams))
88 $cacheData[$messageId] =
$params = $messageParams;
92 $res = self::$forumMessageTableClass::getList([
96 'select' => [
'TOPIC_ID']
99 ($forumMessageFields = $res->fetch())
100 && !empty($forumMessageFields[
'TOPIC_ID'])
103 $res = self::$forumMessageTableClass::getList([
105 '=TOPIC_ID' => (
int)$forumMessageFields[
'TOPIC_ID']
107 'select' => [
'ID',
'SERVICE_DATA',
'POST_MESSAGE' ]
110 ($forumMessageFields = $res->fetch())
112 !empty($forumMessageFields[
'SERVICE_DATA'])
113 || !empty($forumMessageFields[
'POST_MESSAGE'])
119 $messageParams = Json::decode(!empty($forumMessageFields[
'SERVICE_DATA']) ? $forumMessageFields[
'SERVICE_DATA'] : $forumMessageFields[
'POST_MESSAGE']);
120 if (!is_array($messageParams))
130 $cacheData[$forumMessageFields[
'ID']] = $messageParams;
133 $params = ($cacheData[$messageId] ?? []);