]> git.mxchange.org Git - friendica.git/commitdiff
Return early if user contact doesn't exist in Mastodon\Notification::getType
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 23 Nov 2022 15:35:49 +0000 (10:35 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 23 Nov 2022 15:35:49 +0000 (10:35 -0500)
- Address https://github.com/friendica/friendica/issues/11993#issuecomment-1321804594

src/Factory/Api/Mastodon/Notification.php

index adaf2d8689d1b2516e1fdfabbd0b7c0214a89057..32ea681daea2d6f9089e4ad7539abf77a0710d26 100644 (file)
@@ -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])) {