Return early if user contact doesn't exist in Mastodon\Notification::getType

- Address https://github.com/friendica/friendica/issues/11993#issuecomment-1321804594
This commit is contained in:
Hypolite Petovan 2022-11-23 10:35:49 -05:00
parent c356c962f1
commit 8e67d28997

View File

@ -87,6 +87,11 @@ class Notification extends BaseFactory
if (($contact['uid'] == 0) && !empty($contact['uri-id'])) { if (($contact['uid'] == 0) && !empty($contact['uri-id'])) {
$contact = Contact::selectFirst(['pending'], ['uri-id' => $contact['uri-id'], 'uid' => $Notification->uid]); $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; $type = $contact['pending'] ? MstdnNotification::TYPE_INTRODUCTION : MstdnNotification::TYPE_FOLLOW;
} elseif (($Notification->verb == Activity::ANNOUNCE) && } elseif (($Notification->verb == Activity::ANNOUNCE) &&
in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) { in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {