<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
namespace Friendica\Module\Item;
use Friendica\BaseModule;
-use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Item;
*/
class Follow extends BaseModule
{
- public static function rawContent()
+ protected function rawContent(array $request = [])
{
$l10n = DI::l10n();
- if (!Session::isAuthenticated()) {
+ if (!DI::userSession()->isAuthenticated()) {
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval(static::$parameters['id']);
+ $itemId = intval($this->parameters['id']);
- if (!Item::performActivity($itemId, 'follow', local_user())) {
+ if (!Item::performActivity($itemId, 'follow', DI::userSession()->getLocalUserId())) {
throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.'));
}