From 8e67d289977cfe87edfa7854c383eb6e362a13d9 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 23 Nov 2022 10:35:49 -0500 Subject: [PATCH] Return early if user contact doesn't exist in Mastodon\Notification::getType - Address https://github.com/friendica/friendica/issues/11993#issuecomment-1321804594 --- src/Factory/Api/Mastodon/Notification.php | 5 +++++ 1 file changed, 5 insertions(+) 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])) { -- 2.39.5