]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Post/UserNotification.php
Merge pull request #12298 from annando/api-suggestions
[friendica.git] / src / Model / Post / UserNotification.php
index 108f3c44ffcecff806aeaccfcd63ae17ed54c5c7..b26fb292bc6b84d664a87689e2df1b2fc3ba4442 100644 (file)
@@ -178,11 +178,15 @@ class UserNotification
                        return;
                }
 
-               $user = User::getById($uid, ['account-type']);
+               $user = User::getById($uid, ['account-type', 'account_removed', 'account_expired']);
                if (in_array($user['account-type'], [User::ACCOUNT_TYPE_COMMUNITY, User::ACCOUNT_TYPE_RELAY])) {
                        return;
                }
 
+               if ($user['account_removed'] || $user['account_expired']) {
+                       return;
+               }
+
                $author = Contact::getById($item['author-id'], ['contact-type']);
                if (empty($author)) {
                        return;
@@ -431,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;
                        }
                }