From 1f368d469f4916d7424c2ecdaeeaa0a9fde0e6a0 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 26 Oct 2019 02:01:46 +0200 Subject: [PATCH] Move Friendica\Core\NotificationsManager to Friendica\Model\Notify --- include/api.php | 6 +++--- mod/notifications.php | 5 ++--- src/{Core/NotificationsManager.php => Model/Notify.php} | 6 ++---- src/Module/Notifications/Notify.php | 6 +++--- 4 files changed, 10 insertions(+), 13 deletions(-) rename src/{Core/NotificationsManager.php => Model/Notify.php} (99%) diff --git a/include/api.php b/include/api.php index 91e31ac945..711c4fea10 100644 --- a/include/api.php +++ b/include/api.php @@ -15,7 +15,6 @@ use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\NotificationsManager; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Session; @@ -26,6 +25,7 @@ use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\Mail; +use Friendica\Model\Notify; use Friendica\Model\Photo; use Friendica\Model\Profile; use Friendica\Model\User; @@ -6040,7 +6040,7 @@ function api_friendica_notification($type) if ($a->argc!==3) { throw new BadRequestException("Invalid argument count"); } - $nm = new NotificationsManager(); + $nm = new Notify(); $notes = $nm->getAll([], ['seen' => 'ASC', 'date' => 'DESC'], 50); @@ -6084,7 +6084,7 @@ function api_friendica_notification_seen($type) $id = (!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0); - $nm = new NotificationsManager(); + $nm = new Notify(); $note = $nm->getByID($id); if (is_null($note)) { throw new BadRequestException("Invalid argument"); diff --git a/mod/notifications.php b/mod/notifications.php index 8fbc5dac49..a288a03582 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -9,14 +9,13 @@ use Friendica\Content\ContactSelector; use Friendica\Content\Nav; use Friendica\Content\Pager; use Friendica\Core\L10n; -use Friendica\Core\NotificationsManager; use Friendica\Core\Protocol; use Friendica\Core\Renderer; -use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Module\Login; use Friendica\Model\Contact; +use Friendica\Model\Notify; function notifications_post(App $a) { @@ -85,7 +84,7 @@ function notifications_content(App $a) $json = (($a->argc > 1 && $a->argv[$a->argc - 1] === 'json') ? true : false); - $nm = new NotificationsManager(); + $nm = new Notify(); $o = ''; // Get the nav tabs for the notification pages diff --git a/src/Core/NotificationsManager.php b/src/Model/Notify.php similarity index 99% rename from src/Core/NotificationsManager.php rename to src/Model/Notify.php index cf2dd9e36d..9efedc031b 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Model/Notify.php @@ -4,14 +4,12 @@ * @brief Methods for read and write notifications from/to database * or for formatting notifications */ -namespace Friendica\Core; +namespace Friendica\Model; use Friendica\BaseObject; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Database\DBA; -use Friendica\Model\Contact; -use Friendica\Model\Item; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Util\Proxy as ProxyUtils; @@ -22,7 +20,7 @@ use Friendica\Util\XML; * @brief Methods for read and write notifications from/to database * or for formatting notifications */ -class NotificationsManager extends BaseObject +final class Notify extends BaseObject { /** * @brief set some extra note properties diff --git a/src/Module/Notifications/Notify.php b/src/Module/Notifications/Notify.php index d31de2cdda..4998a0adbe 100644 --- a/src/Module/Notifications/Notify.php +++ b/src/Module/Notifications/Notify.php @@ -4,8 +4,8 @@ namespace Friendica\Module\Notifications; use Friendica\BaseModule; use Friendica\Core\L10n; -use Friendica\Core\NotificationsManager; use Friendica\Core\System; +use Friendica\Model\Notify as ModelNotify; use Friendica\Network\HTTPException; /** @@ -26,7 +26,7 @@ class Notify extends BaseModule // @TODO: Replace with parameter from router if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all') { - $notificationsManager = new NotificationsManager(); + $notificationsManager = new ModelNotify(); $success = $notificationsManager->setAllSeen(); header('Content-type: application/json; charset=utf-8'); @@ -49,7 +49,7 @@ class Notify extends BaseModule // @TODO: Replace with parameter from router if ($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) { - $notificationsManager = new NotificationsManager(); + $notificationsManager = new ModelNotify(); // @TODO: Replace with parameter from router $note = $notificationsManager->getByID($a->argv[2]); if (!empty($note)) { -- 2.39.5