mirror of
https://github.com/friendica/friendica
synced 2025-05-18 22:24:10 +02:00
UserSession class [5] - Refactor src/Module/ files with DI
This commit is contained in:
parent
a729f3255d
commit
eecc456e0c
78 changed files with 455 additions and 530 deletions
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module\Item;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -38,7 +37,7 @@ class Ignore extends BaseModule
|
|||
{
|
||||
$l10n = DI::l10n();
|
||||
|
||||
if (!Session::isAuthenticated()) {
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
|
||||
}
|
||||
|
||||
|
@ -55,10 +54,10 @@ class Ignore extends BaseModule
|
|||
throw new HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$ignored = !Post\ThreadUser::getIgnored($thread['uri-id'], Session::getLocalUser());
|
||||
$ignored = !Post\ThreadUser::getIgnored($thread['uri-id'], DI::userSession()->getLocalUserId());
|
||||
|
||||
if (in_array($thread['uid'], [0, Session::getLocalUser()])) {
|
||||
Post\ThreadUser::setIgnored($thread['uri-id'], Session::getLocalUser(), $ignored);
|
||||
if (in_array($thread['uid'], [0, DI::userSession()->getLocalUserId()])) {
|
||||
Post\ThreadUser::setIgnored($thread['uri-id'], DI::userSession()->getLocalUserId(), $ignored);
|
||||
} else {
|
||||
throw new HTTPException\BadRequestException();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue