- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/controller/livefeed.php
- Класс: BitrixSocialnetworkControllerLivefeed
- Вызов: Livefeed::changeFollowAction
public function changeFollowAction($logId, $value): ?array
{
$result = [
'success' => false
];
$logId = (int)$logId;
if ($logId <= 0)
{
return $result;
}
$logId = (int)$logId;
if ($logId <= 0)
{
$this->addError(new Error('No Log Id', 'SONET_CONTROLLER_LIVEFEED_NO_LOG_ID'));
return null;
}
if (!Loader::includeModule('socialnetwork'))
{
$this->addError(new Error('Cannot include Socialnetwork module', 'SONET_CONTROLLER_LIVEFEED_NO_SOCIALNETWORK_MODULE'));
return null;
}
$currentUserId = $this->getCurrentUser()->getId();
$result['success'] = (
$value === 'Y'
? ComponentHelper::userLogSubscribe([
'logId' => $logId,
'userId' => $currentUserId,
'typeList' => [ 'FOLLOW', 'COUNTER_COMMENT_PUSH' ]
])
: CSocNetLogFollow::set($currentUserId, 'L' . $logId, 'N')
);
return $result;
}