Browse Source

Update User\UpdateCountPosts

Visman 3 years ago
parent
commit
a8c610a2db
1 changed files with 4 additions and 3 deletions
  1. 4 3
      app/Models/User/UpdateCountPosts.php

+ 4 - 3
app/Models/User/UpdateCountPosts.php

@@ -23,7 +23,10 @@ class UpdateCountPosts extends Action
     {
         $ids = [];
         foreach ($args as $arg) {
-            if ($arg instanceof User) {
+            if (
+                $arg instanceof User
+                && ! $arg->isGuest
+            ) {
                 $ids[$arg->id] = true;
             } elseif (
                 \is_int($arg)
@@ -34,8 +37,6 @@ class UpdateCountPosts extends Action
                 throw new InvalidArgumentException('Expected user or positive integer id');
             }
         }
-        // сообщения гостя не считаем
-        unset($ids[0]); // ????
 
         if (empty($ids)) {
             $where = '::users.id > 0';