use Friendica\Content\Text\BBCode;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
+use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Database\Database;
-use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Post;
private $baseUrl;
/** @var L10n */
private $l10n;
+ /** @var IHandleUserSessions */
+ private $userSession;
- public function __construct(LoggerInterface $logger, Database $dba, Repository\Notify $notification, BaseURL $baseUrl, L10n $l10n)
+ public function __construct(LoggerInterface $logger, Database $dba, Repository\Notify $notification, BaseURL $baseUrl, L10n $l10n, IHandleUserSessions $userSession)
{
parent::__construct($logger);
- $this->dba = $dba;
- $this->notify = $notification;
- $this->baseUrl = $baseUrl;
- $this->l10n = $l10n;
+ $this->dba = $dba;
+ $this->notify = $notification;
+ $this->baseUrl = $baseUrl;
+ $this->l10n = $l10n;
+ $this->userSession = $userSession;
}
/**
$formattedNotifications = new FormattedNotifies();
try {
- $Notifies = $this->notify->selectForUser(DI::userSession()->getLocalUserId(), $conditions, $params);
+ $Notifies = $this->notify->selectForUser($this->userSession->getLocalUserId(), $conditions, $params);
foreach ($Notifies as $Notify) {
$formattedNotifications[] = new ValueObject\FormattedNotify(
*/
public function getNetworkList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
{
- $condition = ['wall' => false, 'uid' => DI::userSession()->getLocalUserId()];
+ $condition = ['wall' => false, 'uid' => $this->userSession->getLocalUserId()];
if (!$seen) {
$condition['unseen'] = true;
$formattedNotifications = new FormattedNotifies();
try {
- $userPosts = Post::selectForUser(DI::userSession()->getLocalUserId(), $fields, $condition, $params);
+ $userPosts = Post::selectForUser($this->userSession->getLocalUserId(), $fields, $condition, $params);
while ($userPost = $this->dba->fetch($userPosts)) {
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
}
*/
public function getPersonalList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
{
- $condition = ['wall' => false, 'uid' => DI::userSession()->getLocalUserId(), 'author-id' => DI::userSession()->getPublicContactId()];
+ $condition = ['wall' => false, 'uid' => $this->userSession->getLocalUserId(), 'author-id' => $this->userSession->getPublicContactId()];
if (!$seen) {
$condition['unseen'] = true;
$formattedNotifications = new FormattedNotifies();
try {
- $userPosts = Post::selectForUser(DI::userSession()->getLocalUserId(), $fields, $condition, $params);
+ $userPosts = Post::selectForUser($this->userSession->getLocalUserId(), $fields, $condition, $params);
while ($userPost = $this->dba->fetch($userPosts)) {
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
}
*/
public function getHomeList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
{
- $condition = ['wall' => true, 'uid' => DI::userSession()->getLocalUserId()];
+ $condition = ['wall' => true, 'uid' => $this->userSession->getLocalUserId()];
if (!$seen) {
$condition['unseen'] = true;
$formattedNotifications = new FormattedNotifies();
try {
- $userPosts = Post::selectForUser(DI::userSession()->getLocalUserId(), $fields, $condition, $params);
+ $userPosts = Post::selectForUser($this->userSession->getLocalUserId(), $fields, $condition, $params);
while ($userPost = $this->dba->fetch($userPosts)) {
$formattedItem = $this->formatItem($userPost);