1
1
Fork 0

Check post existence before accessing its properties in Model\Post\UserNotification

This commit is contained in:
Hypolite Petovan 2022-11-30 19:30:36 -05:00
parent 1b0f7e5add
commit 8012968506

View file

@ -435,7 +435,7 @@ class UserNotification
// Don't notify about reshares by communities of our own posts or each time someone comments // 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])) { 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]); $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; return false;
} }
} }