From: Hypolite Petovan Date: Wed, 23 Nov 2022 15:35:49 +0000 (-0500) Subject: Return early if user contact doesn't exist in Mastodon\Notification::getType X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8e67d289977cfe87edfa7854c383eb6e362a13d9;p=friendica.git Return early if user contact doesn't exist in Mastodon\Notification::getType - Address https://github.com/friendica/friendica/issues/11993#issuecomment-1321804594 --- diff --git a/src/Factory/Api/Mastodon/Notification.php b/src/Factory/Api/Mastodon/Notification.php index adaf2d8689..32ea681dae 100644 --- a/src/Factory/Api/Mastodon/Notification.php +++ b/src/Factory/Api/Mastodon/Notification.php @@ -87,6 +87,11 @@ class Notification extends BaseFactory if (($contact['uid'] == 0) && !empty($contact['uri-id'])) { $contact = Contact::selectFirst(['pending'], ['uri-id' => $contact['uri-id'], 'uid' => $Notification->uid]); } + + if (!isset($contact['pending'])) { + return ''; + } + $type = $contact['pending'] ? MstdnNotification::TYPE_INTRODUCTION : MstdnNotification::TYPE_FOLLOW; } elseif (($Notification->verb == Activity::ANNOUNCE) && in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {