From 97b6f6b3b3ac1559204749f53ebee62127815829 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Tue, 4 Feb 2020 22:01:55 +0100 Subject: [PATCH] Move OTYPE constants to own enum class --- include/api.php | 2 +- include/enotify.php | 2 +- src/Model/Notify.php | 4 ---- src/Model/Notify/ObjectType.php | 14 ++++++++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 src/Model/Notify/ObjectType.php diff --git a/include/api.php b/include/api.php index 6f5120691c..dda4631ce1 100644 --- a/include/api.php +++ b/include/api.php @@ -5906,7 +5906,7 @@ function api_friendica_notification_seen($type) $notify = DI::notify()->getByID($id); DI::notify()->setSeen(true, $notify); - if ($notify->otype === Notify::OTYPE_ITEM) { + if ($notify->otype === Notify\ObjectType::ITEM) { $item = Item::selectFirstForUser(api_user(), [], ['id' => $notify->iid, 'uid' => api_user()]); if (DBA::isResult($item)) { // we found the item, return it to the user diff --git a/include/enotify.php b/include/enotify.php index 18f5dec889..9f18a472d2 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -134,7 +134,7 @@ function notification($params) // if it's a post figure out who's post it is. $item = null; - if ($params['otype'] === Notify::OTYPE_ITEM && $parent_id) { + if ($params['otype'] === Notify\ObjectType::ITEM && $parent_id) { $item = Item::selectFirstForUser($params['uid'], Item::ITEM_FIELDLIST, ['id' => $parent_id, 'deleted' => false]); } diff --git a/src/Model/Notify.php b/src/Model/Notify.php index 35d72384e8..336b82537b 100644 --- a/src/Model/Notify.php +++ b/src/Model/Notify.php @@ -31,10 +31,6 @@ use Psr\Log\LoggerInterface; */ class Notify extends BaseModel { - const OTYPE_ITEM = 'item'; - const OTYPE_INTRO = 'intro'; - const OTYPE_MAIL = 'mail'; - const OTYPE_PERSON = 'person'; /** @var \Friendica\Repository\Notify */ private $repo; diff --git a/src/Model/Notify/ObjectType.php b/src/Model/Notify/ObjectType.php new file mode 100644 index 0000000000..9fb279adc7 --- /dev/null +++ b/src/Model/Notify/ObjectType.php @@ -0,0 +1,14 @@ +