]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Conversation/Community.php
Fix notices
[friendica.git] / src / Module / Conversation / Community.php
index cbcb50870709533de86ee91958c981bd7e54f849..18332fe27e4cf1f5c4f20cee45e1aca654e74007 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -315,13 +315,13 @@ class Community extends BaseModule
        {
                if (self::$content == 'local') {
                        if (!is_null(self::$accountType)) {
-                               $condition = ["`wall` AND `origin` AND `private` = ? AND `owner`.`contact-type` = ?", Item::PUBLIC, self::$accountType];
+                               $condition = ["`wall` AND `origin` AND `private` = ? AND `owner-contact-type` = ?", Item::PUBLIC, self::$accountType];
                        } else {
                                $condition = ["`wall` AND `origin` AND `private` = ?", Item::PUBLIC];
                        }
                } elseif (self::$content == 'global') {
                        if (!is_null(self::$accountType)) {
-                               $condition = ["`uid` = ? AND `private` = ? AND `owner`.`contact-type` = ?", 0, Item::PUBLIC, self::$accountType];
+                               $condition = ["`uid` = ? AND `private` = ? AND `owner-contact-type` = ?", 0, Item::PUBLIC, self::$accountType];
                        } else {
                                $condition = ["`uid` = ? AND `private` = ?", 0, Item::PUBLIC];
                        }
@@ -332,11 +332,11 @@ class Community extends BaseModule
                $params = ['order' => ['commented' => true], 'limit' => $itemspage];
 
                if (!empty($item_id)) {
-                       $condition[0] .= " AND `iid` = ?";
+                       $condition[0] .= " AND `id` = ?";
                        $condition[] = $item_id;
                } else {
                        if (local_user() && !empty($_REQUEST['no_sharer'])) {
-                               $condition[0] .= " AND NOT EXISTS (SELECT `uri-id` FROM `thread` AS t1 WHERE `t1`.`uri-id` = `thread`.`uri-id` AND `t1`.`uid` = ?)";
+                               $condition[0] .= " AND NOT EXISTS (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uri-id` = `post-thread-user-view`.`uri-id` AND `post-user`.`uid` = ?)";
                                $condition[] = local_user();
                        }
        
@@ -356,9 +356,12 @@ class Community extends BaseModule
                        }
                }
 
-               $r = Item::selectThreadForUser(0, ['uri', 'commented', 'author-link'], $condition, $params);
+               $r = Post::selectThreadForUser(0, ['uri-id', 'commented', 'author-link'], $condition, $params);
 
-               $items = DBA::toArray($r);
+               $items = Post::toArray($r);
+               if (empty($items)) {
+                       return [];
+               }
 
                // Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
                if (empty($item_id) && isset($min_id) && !isset($max_id)) {