mirror of
https://github.com/friendica/friendica
synced 2025-04-27 09:10:12 +00:00
UserSession class [3] - Refactor src/ files excluding Module/Model
This commit is contained in:
parent
a11c125f81
commit
b3f9cef94a
23 changed files with 120 additions and 133 deletions
|
@ -23,7 +23,7 @@ namespace Friendica\Navigation\Notifications\Factory;
|
|||
|
||||
use Friendica\BaseFactory;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Navigation\Notifications\Entity;
|
||||
use Friendica\Navigation\Notifications\Exception\NoMessageException;
|
||||
|
@ -72,7 +72,7 @@ class FormattedNavNotification extends BaseFactory
|
|||
*/
|
||||
public function createFromParams(array $contact, string $message, \DateTime $date, Uri $href, bool $seen = false): ValueObject\FormattedNavNotification
|
||||
{
|
||||
$contact['photo'] = Contact::getAvatarUrlForUrl($contact['url'], Session::getLocalUser(), Proxy::SIZE_MICRO);
|
||||
$contact['photo'] = Contact::getAvatarUrlForUrl($contact['url'], DI::userSession()->getLocalUserId(), Proxy::SIZE_MICRO);
|
||||
|
||||
$dateMySQL = $date->format(DateTimeFormat::MYSQL);
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ use Friendica\BaseFactory;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -211,7 +211,7 @@ class FormattedNotify extends BaseFactory
|
|||
|
||||
$formattedNotifications = new FormattedNotifies();
|
||||
try {
|
||||
$Notifies = $this->notify->selectForUser(Session::getLocalUser(), $conditions, $params);
|
||||
$Notifies = $this->notify->selectForUser(DI::userSession()->getLocalUserId(), $conditions, $params);
|
||||
|
||||
foreach ($Notifies as $Notify) {
|
||||
$formattedNotifications[] = new ValueObject\FormattedNotify(
|
||||
|
@ -244,7 +244,7 @@ class FormattedNotify extends BaseFactory
|
|||
*/
|
||||
public function getNetworkList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
||||
{
|
||||
$condition = ['wall' => false, 'uid' => Session::getLocalUser()];
|
||||
$condition = ['wall' => false, 'uid' => DI::userSession()->getLocalUserId()];
|
||||
|
||||
if (!$seen) {
|
||||
$condition['unseen'] = true;
|
||||
|
@ -257,7 +257,7 @@ class FormattedNotify extends BaseFactory
|
|||
$formattedNotifications = new FormattedNotifies();
|
||||
|
||||
try {
|
||||
$userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
|
||||
$userPosts = Post::selectForUser(DI::userSession()->getLocalUserId(), $fields, $condition, $params);
|
||||
while ($userPost = $this->dba->fetch($userPosts)) {
|
||||
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ class FormattedNotify extends BaseFactory
|
|||
*/
|
||||
public function getPersonalList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
||||
{
|
||||
$condition = ['wall' => false, 'uid' => Session::getLocalUser(), 'author-id' => Session::getPublicContact()];
|
||||
$condition = ['wall' => false, 'uid' => DI::userSession()->getLocalUserId(), 'author-id' => DI::userSession()->getPublicContactId()];
|
||||
|
||||
if (!$seen) {
|
||||
$condition['unseen'] = true;
|
||||
|
@ -293,7 +293,7 @@ class FormattedNotify extends BaseFactory
|
|||
$formattedNotifications = new FormattedNotifies();
|
||||
|
||||
try {
|
||||
$userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
|
||||
$userPosts = Post::selectForUser(DI::userSession()->getLocalUserId(), $fields, $condition, $params);
|
||||
while ($userPost = $this->dba->fetch($userPosts)) {
|
||||
$formattedNotifications[] = $this->createFromFormattedItem($this->formatItem($userPost));
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ class FormattedNotify extends BaseFactory
|
|||
*/
|
||||
public function getHomeList(bool $seen = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT): FormattedNotifies
|
||||
{
|
||||
$condition = ['wall' => true, 'uid' => Session::getLocalUser()];
|
||||
$condition = ['wall' => true, 'uid' => DI::userSession()->getLocalUserId()];
|
||||
|
||||
if (!$seen) {
|
||||
$condition['unseen'] = true;
|
||||
|
@ -329,7 +329,7 @@ class FormattedNotify extends BaseFactory
|
|||
$formattedNotifications = new FormattedNotifies();
|
||||
|
||||
try {
|
||||
$userPosts = Post::selectForUser(Session::getLocalUser(), $fields, $condition, $params);
|
||||
$userPosts = Post::selectForUser(DI::userSession()->getLocalUserId(), $fields, $condition, $params);
|
||||
while ($userPost = $this->dba->fetch($userPosts)) {
|
||||
$formattedItem = $this->formatItem($userPost);
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\BaseNotifications;
|
||||
use Friendica\Navigation\Notifications\ValueObject;
|
||||
|
@ -143,7 +143,7 @@ class Introduction extends BaseFactory
|
|||
'url' => $intro['furl'],
|
||||
'zrl' => Contact::magicLink($intro['furl']),
|
||||
'hidden' => $intro['hidden'] == 1,
|
||||
'post_newfriend' => (intval($this->pConfig->get(Session::getLocalUser(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||
'post_newfriend' => (intval($this->pConfig->get(DI::userSession()->getLocalUserId(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||
'note' => $intro['note'],
|
||||
'request' => $intro['frequest'] . '?addr=' . $return_addr]);
|
||||
|
||||
|
@ -168,7 +168,7 @@ class Introduction extends BaseFactory
|
|||
'about' => BBCode::convert($intro['about'], false),
|
||||
'keywords' => $intro['keywords'],
|
||||
'hidden' => $intro['hidden'] == 1,
|
||||
'post_newfriend' => (intval($this->pConfig->get(Session::getLocalUser(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||
'post_newfriend' => (intval($this->pConfig->get(DI::userSession()->getLocalUserId(), 'system', 'post_newfriend')) ? '1' : 0),
|
||||
'url' => $intro['url'],
|
||||
'zrl' => Contact::magicLink($intro['url']),
|
||||
'addr' => $intro['addr'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue