use Friendica\BaseModule;
use Friendica\Content\Conversation\Collection\Timelines;
use Friendica\Content\Conversation\Entity\Channel as ChannelEntity;
+use Friendica\Content\Conversation\Entity\Community;
use Friendica\Content\Conversation\Entity\UserDefinedChannel as UserDefinedChannelEntity;
use Friendica\Content\Conversation\Repository\UserDefinedChannel;
use Friendica\Core\Cache\Capability\ICanCache;
/** @var bool */
protected $update;
/** @var bool */
+ protected $ping;
+ /** @var bool */
protected $raw;
/** @var string */
protected $order;
protected function getNoSharerWidget(string $base): string
{
$path = $this->selectedTab;
+
+ $query_parameters = [];
if (!empty($this->accountTypeString)) {
- $path .= '/' . $this->accountTypeString;
+ $query_parameters['accounttype'] = $this->accountTypeString;
}
- $query_parameters = [];
-
if (!empty($this->minId)) {
$query_parameters['min_id'] = $this->minId;
}
protected function getChannelItems(array $request)
{
$items = $this->getRawChannelItems($request);
+ $total = min(count($items), $this->itemsPerPage);
$contacts = $this->database->selectToArray('user-contact', ['cid'], ['channel-frequency' => Contact\User::FREQUENCY_REDUCED, 'cid' => array_column($items, 'owner-id')]);
$reduced = array_column($contacts, 'cid');
$owner_posts = [];
$selected_items = [];
- while (count($selected_items) < $this->itemsPerPage && ++$count < 50 && count($items) > 0) {
- $maxposts = round((count($items) / $this->itemsPerPage) * $maxpostperauthor);
+ while (count($selected_items) < $total && ++$count < 50 && count($items) > 0) {
+ $maxposts = round((count($items) / $total) * $maxpostperauthor);
$minId = $items[array_key_first($items)][$this->order];
$maxId = $items[array_key_last($items)][$this->order];
$this->maxId = $maxId;
}
- if (count($selected_items) < $this->itemsPerPage) {
+ if (count($selected_items) < $total) {
$items = $this->getRawChannelItems($request);
}
}
if (!empty($channel->fullTextSearch)) {
if (!empty($channel->includeTags)) {
- $additional = self:: addIncludeTags($channel->includeTags);
+ $additional = $this->addIncludeTags($channel->includeTags);
} else {
$additional = '';
}
}
if (!empty($channel->mediaType)) {
- $additional .= self::addMediaTerms($channel->mediaType);
+ $additional .= $this->addMediaTerms($channel->mediaType);
}
- $additional .= self::addLanguageSearchTerms($uid, $channel->languages);
+ $additional .= $this->addLanguageSearchTerms($uid, $channel->languages);
if ($additional) {
$searchterms = '+(' . trim($channel->fullTextSearch) . ')' . $additional;
{
$items = $this->selectItems();
- if ($this->selectedTab == 'local') {
+ if ($this->selectedTab == Community::LOCAL) {
$maxpostperauthor = (int)$this->config->get('system', 'max_author_posts_community_page');
$key = 'author-id';
- } elseif ($this->selectedTab == 'global') {
+ } elseif ($this->selectedTab == Community::GLOBAL) {
$maxpostperauthor = (int)$this->config->get('system', 'max_server_posts_community_page');
$key = 'author-gsid';
} else {
{
$this->order = 'received';
- if ($this->selectedTab == 'local') {
+ if ($this->selectedTab == Community::LOCAL) {
$condition = ["`wall` AND `origin` AND `private` = ?", Item::PUBLIC];
} elseif ($this->selectedTab == 'global') {
$condition = ["`uid` = ? AND `private` = ?", 0, Item::PUBLIC];
}
$items = [];
- $result = Post::selectThreadForUser($this->session->getLocalUserId() ?: 0, ['uri-id', 'received', 'author-id', 'author-gsid'], $condition, $params);
+ if ($this->selectedTab == Community::LOCAL) {
+ $result = Post::selectOriginThread(['uri-id', 'received', 'author-id', 'author-gsid'], $condition, $params);
+ } else {
+ $result = Post::selectThreadForUser($this->session->getLocalUserId() ?: 0, ['uri-id', 'received', 'author-id', 'author-gsid'], $condition, $params);
+ }
while ($item = $this->database->fetch($result)) {
$item['comments'] = 0;
*/
protected function setItemsSeenByCondition(array $condition)
{
- if (empty($condition)) {
+ if (empty($condition) || $this->ping) {
return;
}