]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Notify.php
Merge pull request #8149 from annando/fix-warning
[friendica.git] / src / Model / Notify.php
index 2d9ad9142fc70e44ac0f349fd4f103ec00083c5a..a27635a07e722bd161ed0098fb16d58bbd2afd8c 100644 (file)
@@ -4,14 +4,14 @@ namespace Friendica\Model;
 
 use Exception;
 use Friendica\App;
-use Friendica\BaseObject;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
-use Friendica\Core\Config\PConfiguration;
-use Friendica\Core\L10n\L10n;
+use Friendica\Core\PConfig\IPConfig;
+use Friendica\Core\L10n;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\Database;
+use Friendica\DI;
 use Friendica\Protocol\Activity;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Proxy as ProxyUtils;
@@ -22,11 +22,14 @@ use Psr\Log\LoggerInterface;
 use Friendica\Network\HTTPException;
 
 /**
- * @brief Methods for read and write notifications from/to database
+ * Methods for read and write notifications from/to database
  *  or for formatting notifications
  */
-final class Notify extends BaseObject
+final class Notify
 {
+       /** @var int The default limit of notifies per page */
+       const DEFAULT_PAGE_LIMIT = 80;
+
        const NETWORK  = 'network';
        const SYSTEM   = 'system';
        const PERSONAL = 'personal';
@@ -68,13 +71,13 @@ final class Notify extends BaseObject
        private $args;
        /** @var App\BaseURL */
        private $baseUrl;
-       /** @var PConfiguration */
+       /** @var IPConfig */
        private $pConfig;
        /** @var LoggerInterface */
        private $logger;
 
        public function __construct(Database $dba, L10n $l10n, App\Arguments $args, App\BaseURL $baseUrl,
-                                   PConfiguration $pConfig, LoggerInterface $logger)
+                                   IPConfig $pConfig, LoggerInterface $logger)
        {
                $this->dba     = $dba;
                $this->l10n    = $l10n;
@@ -113,7 +116,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Get all notifications for local_user()
+        * Get all notifications for local_user()
         *
         * @param array  $filter optional Array "column name"=>value: filter query by columns values
         * @param array  $order  optional Array to order by
@@ -144,7 +147,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Get one note for local_user() by $id value
+        * Get one note for local_user() by $id value
         *
         * @param int $id identity
         *
@@ -161,7 +164,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief set seen state of $note of local_user()
+        * set seen state of $note of local_user()
         *
         * @param array $note note array
         * @param bool  $seen optional true or false, default true
@@ -181,7 +184,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief set seen state of all notifications of local_user()
+        * Set seen state of all notifications of local_user()
         *
         * @param bool $seen optional true or false. default true
         *
@@ -194,7 +197,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief List of pages for the Notifications TabBar
+        * List of pages for the Notifications TabBar
         *
         * @return array with with notifications TabBar data
         * @throws Exception
@@ -219,7 +222,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Format the notification query in an usable array
+        * Format the notification query in an usable array
         *
         * @param array  $notifies The array from the db query
         * @param string $ident    The notifications identifier (e.g. network)
@@ -235,161 +238,128 @@ final class Notify extends BaseObject
         *                       bool 'seen' => Is the notification marked as "seen"
         * @throws Exception
         */
-       private function formatNotifies(array $notifies, string $ident = "")
+       private function formatList(array $notifies, string $ident = "")
        {
-               $arr = [];
-
-               if ($this->dba->isResult($notifies)) {
-                       foreach ($notifies as $notify) {
-                               // Because we use different db tables for the notification query
-                               // we have sometimes $notify['unseen'] and sometimes $notify['seen].
-                               // So we will have to transform $notify['unseen']
-                               if (array_key_exists('unseen', $notify)) {
-                                       $notify['seen'] = ($notify['unseen'] > 0 ? false : true);
-                               }
-
-                               // For feed items we use the user's contact, since the avatar is mostly self choosen.
-                               if (!empty($notify['network']) && $notify['network'] == Protocol::FEED) {
-                                       $notify['author-avatar'] = $notify['contact-avatar'];
-                               }
-
-                               // Depending on the identifier of the notification we need to use different defaults
-                               switch ($ident) {
-                                       case self::SYSTEM:
-                                               $default_item_label = 'notify';
-                                               $default_item_link  = $this->baseUrl->get(true) . '/notify/view/' . $notify['id'];
-                                               $default_item_image = ProxyUtils::proxifyUrl($notify['photo'], false, ProxyUtils::SIZE_MICRO);
-                                               $default_item_url   = $notify['url'];
-                                               $default_item_text  = strip_tags(BBCode::convert($notify['msg']));
-                                               $default_item_when  = DateTimeFormat::local($notify['date'], 'r');
-                                               $default_item_ago   = Temporal::getRelativeDate($notify['date']);
-                                               break;
-
-                                       case self::HOME:
-                                               $default_item_label = 'comment';
-                                               $default_item_link  = $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'];
-                                               $default_item_image = ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO);
-                                               $default_item_url   = $notify['author-link'];
-                                               $default_item_text  = $this->l10n->t("%s commented on %s's post", $notify['author-name'], $notify['parent-author-name']);
-                                               $default_item_when  = DateTimeFormat::local($notify['created'], 'r');
-                                               $default_item_ago   = Temporal::getRelativeDate($notify['created']);
-                                               break;
-
-                                       default:
-                                               $default_item_label = (($notify['id'] == $notify['parent']) ? 'post' : 'comment');
-                                               $default_item_link  = $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'];
-                                               $default_item_image = ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO);
-                                               $default_item_url   = $notify['author-link'];
-                                               $default_item_text  = (($notify['id'] == $notify['parent'])
-                                                       ? $this->l10n->t("%s created a new post", $notify['author-name'])
-                                                       : $this->l10n->t("%s commented on %s's post", $notify['author-name'], $notify['parent-author-name']));
-                                               $default_item_when  = DateTimeFormat::local($notify['created'], 'r');
-                                               $default_item_ago   = Temporal::getRelativeDate($notify['created']);
-                               }
-
-                               // Transform the different types of notification in an usable array
-                               switch ($notify['verb']) {
-                                       case Activity::LIKE:
-                                               $notify = [
-                                                       'label' => 'like',
-                                                       'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
-                                                       'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
-                                                       'url'   => $notify['author-link'],
-                                                       'text'  => $this->l10n->t("%s liked %s's post", $notify['author-name'], $notify['parent-author-name']),
-                                                       'when'  => $default_item_when,
-                                                       'ago'   => $default_item_ago,
-                                                       'seen'  => $notify['seen']
-                                               ];
-                                               break;
-
-                                       case Activity::DISLIKE:
-                                               $notify = [
-                                                       'label' => 'dislike',
-                                                       'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
-                                                       'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
-                                                       'url'   => $notify['author-link'],
-                                                       'text'  => $this->l10n->t("%s disliked %s's post", $notify['author-name'], $notify['parent-author-name']),
-                                                       'when'  => $default_item_when,
-                                                       'ago'   => $default_item_ago,
-                                                       'seen'  => $notify['seen']
-                                               ];
-                                               break;
-
-                                       case Activity::ATTEND:
-                                               $notify = [
-                                                       'label' => 'attend',
-                                                       'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
-                                                       'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
-                                                       'url'   => $notify['author-link'],
-                                                       'text'  => $this->l10n->t("%s is attending %s's event", $notify['author-name'], $notify['parent-author-name']),
-                                                       'when'  => $default_item_when,
-                                                       'ago'   => $default_item_ago,
-                                                       'seen'  => $notify['seen']
-                                               ];
-                                               break;
+               $formattedNotifies = [];
+
+               foreach ($notifies as $notify) {
+                       // Because we use different db tables for the notification query
+                       // we have sometimes $notify['unseen'] and sometimes $notify['seen].
+                       // So we will have to transform $notify['unseen']
+                       if (array_key_exists('unseen', $notify)) {
+                               $notify['seen'] = ($notify['unseen'] > 0 ? false : true);
+                       }
 
-                                       case Activity::ATTENDNO:
-                                               $notify = [
-                                                       'label' => 'attendno',
-                                                       'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
-                                                       'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
-                                                       'url'   => $notify['author-link'],
-                                                       'text'  => $this->l10n->t("%s is not attending %s's event", $notify['author-name'], $notify['parent-author-name']),
-                                                       'when'  => $default_item_when,
-                                                       'ago'   => $default_item_ago,
-                                                       'seen'  => $notify['seen']
-                                               ];
-                                               break;
+                       // For feed items we use the user's contact, since the avatar is mostly self choosen.
+                       if (!empty($notify['network']) && $notify['network'] == Protocol::FEED) {
+                               $notify['author-avatar'] = $notify['contact-avatar'];
+                       }
 
-                                       case Activity::ATTENDMAYBE:
-                                               $notify = [
-                                                       'label' => 'attendmaybe',
-                                                       'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
-                                                       'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
-                                                       'url'   => $notify['author-link'],
-                                                       'text'  => $this->l10n->t("%s may attend %s's event", $notify['author-name'], $notify['parent-author-name']),
-                                                       'when'  => $default_item_when,
-                                                       'ago'   => $default_item_ago,
-                                                       'seen'  => $notify['seen']
-                                               ];
-                                               break;
+                       // Depending on the identifier of the notification we need to use different defaults
+                       switch ($ident) {
+                               case self::SYSTEM:
+                                       $default_item_label = 'notify';
+                                       $default_item_link  = $this->baseUrl->get(true) . '/notify/view/' . $notify['id'];
+                                       $default_item_image = ProxyUtils::proxifyUrl($notify['photo'], false, ProxyUtils::SIZE_MICRO);
+                                       $default_item_url   = $notify['url'];
+                                       $default_item_text  = strip_tags(BBCode::convert($notify['msg']));
+                                       $default_item_when  = DateTimeFormat::local($notify['date'], 'r');
+                                       $default_item_ago   = Temporal::getRelativeDate($notify['date']);
+                                       break;
+
+                               case self::HOME:
+                                       $default_item_label = 'comment';
+                                       $default_item_link  = $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'];
+                                       $default_item_image = ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO);
+                                       $default_item_url   = $notify['author-link'];
+                                       $default_item_text  = $this->l10n->t("%s commented on %s's post", $notify['author-name'], $notify['parent-author-name']);
+                                       $default_item_when  = DateTimeFormat::local($notify['created'], 'r');
+                                       $default_item_ago   = Temporal::getRelativeDate($notify['created']);
+                                       break;
+
+                               default:
+                                       $default_item_label = (($notify['id'] == $notify['parent']) ? 'post' : 'comment');
+                                       $default_item_link  = $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'];
+                                       $default_item_image = ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO);
+                                       $default_item_url   = $notify['author-link'];
+                                       $default_item_text  = (($notify['id'] == $notify['parent'])
+                                               ? $this->l10n->t("%s created a new post", $notify['author-name'])
+                                               : $this->l10n->t("%s commented on %s's post", $notify['author-name'], $notify['parent-author-name']));
+                                       $default_item_when  = DateTimeFormat::local($notify['created'], 'r');
+                                       $default_item_ago   = Temporal::getRelativeDate($notify['created']);
+                       }
 
-                                       case Activity::FRIEND:
-                                               if (!isset($notify['object'])) {
-                                                       $notify = [
-                                                               'label' => 'friend',
-                                                               'link'  => $default_item_link,
-                                                               'image' => $default_item_image,
-                                                               'url'   => $default_item_url,
-                                                               'text'  => $default_item_text,
-                                                               'when'  => $default_item_when,
-                                                               'ago'   => $default_item_ago,
-                                                               'seen'  => $notify['seen']
-                                                       ];
-                                                       break;
-                                               }
-                                               /// @todo Check if this part here is used at all
-                                               $this->logger->info('Complete data.', ['notify' => $notify, 'callStack' => System::callstack(20)]);
-
-                                               $xmlHead         = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
-                                               $obj             = XML::parseString($xmlHead . $notify['object']);
-                                               $notify['fname'] = $obj->title;
-
-                                               $notify = [
+                       // Transform the different types of notification in an usable array
+                       switch ($notify['verb']) {
+                               case Activity::LIKE:
+                                       $formattedNotify = [
+                                               'label' => 'like',
+                                               'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
+                                               'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
+                                               'url'   => $notify['author-link'],
+                                               'text'  => $this->l10n->t("%s liked %s's post", $notify['author-name'], $notify['parent-author-name']),
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
+                                       break;
+
+                               case Activity::DISLIKE:
+                                       $formattedNotify = [
+                                               'label' => 'dislike',
+                                               'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
+                                               'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
+                                               'url'   => $notify['author-link'],
+                                               'text'  => $this->l10n->t("%s disliked %s's post", $notify['author-name'], $notify['parent-author-name']),
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
+                                       break;
+
+                               case Activity::ATTEND:
+                                       $formattedNotify = [
+                                               'label' => 'attend',
+                                               'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
+                                               'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
+                                               'url'   => $notify['author-link'],
+                                               'text'  => $this->l10n->t("%s is attending %s's event", $notify['author-name'], $notify['parent-author-name']),
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
+                                       break;
+
+                               case Activity::ATTENDNO:
+                                       $formattedNotify = [
+                                               'label' => 'attendno',
+                                               'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
+                                               'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
+                                               'url'   => $notify['author-link'],
+                                               'text'  => $this->l10n->t("%s is not attending %s's event", $notify['author-name'], $notify['parent-author-name']),
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
+                                       break;
+
+                               case Activity::ATTENDMAYBE:
+                                       $formattedNotify = [
+                                               'label' => 'attendmaybe',
+                                               'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
+                                               'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
+                                               'url'   => $notify['author-link'],
+                                               'text'  => $this->l10n->t("%s may attend %s's event", $notify['author-name'], $notify['parent-author-name']),
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
+                                       break;
+
+                               case Activity::FRIEND:
+                                       if (!isset($notify['object'])) {
+                                               $formattedNotify = [
                                                        'label' => 'friend',
-                                                       'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
-                                                       'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
-                                                       'url'   => $notify['author-link'],
-                                                       'text'  => $this->l10n->t("%s is now friends with %s", $notify['author-name'], $notify['fname']),
-                                                       'when'  => $default_item_when,
-                                                       'ago'   => $default_item_ago,
-                                                       'seen'  => $notify['seen']
-                                               ];
-                                               break;
-
-                                       default:
-                                               $notify = [
-                                                       'label' => $default_item_label,
                                                        'link'  => $default_item_link,
                                                        'image' => $default_item_image,
                                                        'url'   => $default_item_url,
@@ -398,19 +368,50 @@ final class Notify extends BaseObject
                                                        'ago'   => $default_item_ago,
                                                        'seen'  => $notify['seen']
                                                ];
-                               }
-
-                               $arr[] = $notify;
+                                               break;
+                                       }
+                                       /// @todo Check if this part here is used at all
+                                       $this->logger->info('Complete data.', ['notify' => $notify, 'callStack' => System::callstack(20)]);
+
+                                       $xmlHead         = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
+                                       $obj             = XML::parseString($xmlHead . $notify['object']);
+                                       $notify['fname'] = $obj->title;
+
+                                       $formattedNotify = [
+                                               'label' => 'friend',
+                                               'link'  => $this->baseUrl->get(true) . '/display/' . $notify['parent-guid'],
+                                               'image' => ProxyUtils::proxifyUrl($notify['author-avatar'], false, ProxyUtils::SIZE_MICRO),
+                                               'url'   => $notify['author-link'],
+                                               'text'  => $this->l10n->t("%s is now friends with %s", $notify['author-name'], $notify['fname']),
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
+                                       break;
+
+                               default:
+                                       $formattedNotify = [
+                                               'label' => $default_item_label,
+                                               'link'  => $default_item_link,
+                                               'image' => $default_item_image,
+                                               'url'   => $default_item_url,
+                                               'text'  => $default_item_text,
+                                               'when'  => $default_item_when,
+                                               'ago'   => $default_item_ago,
+                                               'seen'  => $notify['seen']
+                                       ];
                        }
+
+                       $formattedNotifies[] = $formattedNotify;
                }
 
-               return $arr;
+               return $formattedNotifies;
        }
 
        /**
-        * @brief Get network notifications
+        * Get network notifications
         *
-        * @param int|string $seen    If 0 only include notifications into the query
+        * @param bool $seen    False => only include notifications into the query
         *                            which aren't marked as "seen"
         * @param int        $start   Start the query at this point
         * @param int        $limit   Maximum number of query results
@@ -421,14 +422,14 @@ final class Notify extends BaseObject
         *
         * @throws Exception
         */
-       public function getNetworkNotifies(int $seen = 0, int $start = 0, int $limit = 80)
+       public function getNetworkList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT)
        {
                $ident    = self::NETWORK;
                $notifies = [];
 
                $condition = ['wall' => false, 'uid' => local_user()];
 
-               if ($seen === 0) {
+               if (!$seen) {
                        $condition['unseen'] = true;
                }
 
@@ -439,7 +440,7 @@ final class Notify extends BaseObject
                $items = Item::selectForUser(local_user(), $fields, $condition, $params);
 
                if ($this->dba->isResult($items)) {
-                       $notifies = $this->formatNotifies(Item::inArray($items), $ident);
+                       $notifies = $this->formatList(Item::inArray($items), $ident);
                }
 
                $arr = [
@@ -451,9 +452,9 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Get system notifications
+        * Get system notifications
         *
-        * @param int|string $seen    If 0 only include notifications into the query
+        * @param bool $seen    False => only include notifications into the query
         *                            which aren't marked as "seen"
         * @param int        $start   Start the query at this point
         * @param int        $limit   Maximum number of query results
@@ -464,13 +465,13 @@ final class Notify extends BaseObject
         *
         * @throws Exception
         */
-       public function getSystemNotifies(int $seen = 0, int $start = 0, int $limit = 80)
+       public function getSystemList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT)
        {
                $ident    = self::SYSTEM;
                $notifies = [];
 
                $filter = ['uid' => local_user()];
-               if ($seen === 0) {
+               if (!$seen) {
                        $filter['seen'] = false;
                }
 
@@ -484,7 +485,7 @@ final class Notify extends BaseObject
                        $params);
 
                if ($this->dba->isResult($stmtNotifies)) {
-                       $notifies = $this->formatNotifies($this->dba->toArray($stmtNotifies), $ident);
+                       $notifies = $this->formatList($this->dba->toArray($stmtNotifies), $ident);
                }
 
                $arr = [
@@ -496,9 +497,9 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Get personal notifications
+        * Get personal notifications
         *
-        * @param int|string $seen    If 0 only include notifications into the query
+        * @param bool $seen    False => only include notifications into the query
         *                            which aren't marked as "seen"
         * @param int        $start   Start the query at this point
         * @param int        $limit   Maximum number of query results
@@ -509,18 +510,18 @@ final class Notify extends BaseObject
         *
         * @throws Exception
         */
-       public function getPersonalNotifies(int $seen = 0, int $start = 0, int $limit = 80)
+       public function getPersonalList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT)
        {
                $ident    = self::PERSONAL;
                $notifies = [];
 
-               $myurl     = str_replace('http://', '', self::getApp()->contact['nurl']);
+               $myurl     = str_replace('http://', '', DI::app()->contact['nurl']);
                $diasp_url = str_replace('/profile/', '/u/', $myurl);
 
                $condition = ["NOT `wall` AND `uid` = ? AND (`item`.`author-id` = ? OR `item`.`tag` REGEXP ? OR `item`.`tag` REGEXP ?)",
                        local_user(), public_contact(), $myurl . '\\]', $diasp_url . '\\]'];
 
-               if ($seen === 0) {
+               if (!$seen) {
                        $condition[0] .= " AND `unseen`";
                }
 
@@ -531,7 +532,7 @@ final class Notify extends BaseObject
                $items = Item::selectForUser(local_user(), $fields, $condition, $params);
 
                if ($this->dba->isResult($items)) {
-                       $notifies = $this->formatNotifies(Item::inArray($items), $ident);
+                       $notifies = $this->formatList(Item::inArray($items), $ident);
                }
 
                $arr = [
@@ -543,9 +544,9 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Get home notifications
+        * Get home notifications
         *
-        * @param int|string $seen    If 0 only include notifications into the query
+        * @param bool $seen    False => only include notifications into the query
         *                            which aren't marked as "seen"
         * @param int        $start   Start the query at this point
         * @param int        $limit   Maximum number of query results
@@ -556,14 +557,14 @@ final class Notify extends BaseObject
         *
         * @throws Exception
         */
-       public function getHomeNotifies($seen = 0, int $start = 0, int $limit = 80)
+       public function getHomeList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT)
        {
                $ident    = self::HOME;
                $notifies = [];
 
-               $condition = ['wall' => false, 'uid' => local_user()];
+               $condition = ['wall' => true, 'uid' => local_user()];
 
-               if ($seen === 0) {
+               if (!$seen) {
                        $condition['unseen'] = true;
                }
 
@@ -574,7 +575,7 @@ final class Notify extends BaseObject
                $items = Item::selectForUser(local_user(), $fields, $condition, $params);
 
                if ($this->dba->isResult($items)) {
-                       $notifies = $this->formatNotifies(Item::inArray($items), $ident);
+                       $notifies = $this->formatList(Item::inArray($items), $ident);
                }
 
                $arr = [
@@ -586,7 +587,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Get introductions
+        * Get introductions
         *
         * @param bool $all     If false only include introductions into the query
         *                      which aren't marked as ignored
@@ -601,7 +602,7 @@ final class Notify extends BaseObject
         * @throws ImagickException
         * @throws Exception
         */
-       public function getIntroNotifies($all = false, int $start = 0, int $limit = 80, int $id = 0)
+       public function getIntroList(bool $all = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT, int $id = 0)
        {
                /// @todo sanitize wording according to SELF::INTRO
                $ident     = 'introductions';
@@ -637,7 +638,7 @@ final class Notify extends BaseObject
                        $limit
                );
                if ($this->dba->isResult($stmtNotifies)) {
-                       $notifies = $this->formatIntros($this->dba->toArray($stmtNotifies));
+                       $notifies = $this->formatIntroList($this->dba->toArray($stmtNotifies));
                }
 
                $arr = [
@@ -649,7 +650,7 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Format the notification query in an usable array
+        * Format the notification query in an usable array
         *
         * @param array $intros The array from the db query
         *
@@ -657,7 +658,7 @@ final class Notify extends BaseObject
         * @throws HTTPException\InternalServerErrorException
         * @throws ImagickException
         */
-       private function formatIntros(array $intros)
+       private function formatIntroList(array $intros)
        {
                $knowyou = '';
 
@@ -668,7 +669,7 @@ final class Notify extends BaseObject
                        // We have to distinguish between these two because they use different data.
                        // Contact suggestions
                        if ($intro['fid']) {
-                               $return_addr = bin2hex(self::getApp()->user['nickname'] . '@' .
+                               $return_addr = bin2hex(DI::app()->user['nickname'] . '@' .
                                                       $this->baseUrl->getHostName() .
                                                       (($this->baseUrl->getURLPath()) ? '/' . $this->baseUrl->getURLPath() : ''));
 
@@ -737,8 +738,8 @@ final class Notify extends BaseObject
        }
 
        /**
-        * @brief Check for missing contact data and try to fetch the data from
-        *     from other sources
+        * Check for missing contact data and try to fetch the data from
+        * from other sources
         *
         * @param array $intro The input array with the intro data
         *