]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Circle.php
Merge pull request #13580 from annando/fetch-async
[friendica.git] / src / Model / Circle.php
index 2b32103db99715a56e0f8d9dd36fca9e61cb6b45..92e3ea656010a6fed2c439a1e87c1929a467864f 100644 (file)
@@ -169,16 +169,17 @@ class Circle
         *
         * Count unread items of each circle of the local user
         *
+        * @param int $uid
         * @return array
         *    'id' => circle id
         *    'name' => circle name
         *    'count' => counted unseen circle items
         * @throws \Exception
         */
-       public static function countUnseen()
+       public static function countUnseen(int $uid)
        {
                $stmt = DBA::p("SELECT `circle`.`id`, `circle`.`name`,
-                               (SELECT COUNT(*) FROM `post-user-view`
+                               (SELECT COUNT(*) FROM `post-user`
                                        WHERE `uid` = ?
                                        AND `unseen`
                                        AND `contact-id` IN
@@ -188,8 +189,8 @@ class Circle
                                        ) AS `count`
                                FROM `group` AS `circle`
                                WHERE `circle`.`uid` = ?;",
-                       DI::userSession()->getLocalUserId(),
-                       DI::userSession()->getLocalUserId()
+                       $uid,
+                       $uid
                );
 
                return DBA::toArray($stmt);