<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
{
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];
}
$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();
}
}
}
- $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)) {