Merge pull request #12305 from MrPetovan/bug/notices

Check post existence before accessing its properties in Model\Post\UserNotification
This commit is contained in:
Michael Vogel 2022-12-01 06:45:50 +01:00 committed by GitHub
commit 13cc638062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -435,7 +435,7 @@ class UserNotification
// Don't notify about reshares by communities of our own posts or each time someone comments
if (($item['verb'] == Activity::ANNOUNCE) && DBA::exists('contact', ['id' => $item['contact-id'], 'contact-type' => Contact::TYPE_COMMUNITY])) {
$post = Post::selectFirst(['origin', 'gravity'], ['uri-id' => $item['thr-parent-id'], 'uid' => $uid]);
if ($post['origin'] || ($post['gravity'] != Item::GRAVITY_PARENT)) {
if (!$post || $post['origin'] || ($post['gravity'] != Item::GRAVITY_PARENT)) {
return false;
}
}