use Friendica\Content\Conversation;
use Friendica\Core\System;
-use Friendica\Model\Item;
-use Friendica\Model\Post;
use Friendica\Module\Conversation\Network as NetworkModule;
class Network extends NetworkModule
$this->parseRequest($request);
- $profile_uid = intval($request['p']);
-
$o = '';
- if (empty($request['force'])) {
+ if (!$this->update && !$this->force) {
System::htmlUpdateExit($o);
}
- if (!empty($request['item'])) {
- $item = Post::selectFirst(['parent'], ['id' => $request['item']]);
- $parent = $item['parent'] ?? 0;
- } else {
- $parent = 0;
- }
-
- $conditionFields = [];
- if (!empty($parent)) {
- // Load only a single thread
- $conditionFields['parent'] = $parent;
- } elseif (self::$order === 'received') {
- // Only load new toplevel posts
- $conditionFields['unseen'] = true;
- $conditionFields['gravity'] = Item::GRAVITY_PARENT;
- } else {
- // Load all unseen items
- $conditionFields['unseen'] = true;
- }
-
- $params = ['limit' => self::$itemsPerPage];
- $table = 'network-thread-view';
-
- $items = $this->getItems($table, $params, $conditionFields);
-
- if (self::$order === 'received') {
- $ordering = '`received`';
- } elseif (self::$order === 'created') {
- $ordering = '`created`';
+ if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) {
+ $items = $this->getChannelItems();
+ } elseif ($this->timeline->isCommunity($this->selectedTab)) {
+ $items = $this->getCommunityItems();
} else {
- $ordering = '`commented`';
+ $items = $this->getItems();
}
- $o = $this->conversation->render($items, Conversation::MODE_NETWORK, $profile_uid, false, $ordering, $this->session->getLocalUserId());
+ $o = $this->conversation->render($items, Conversation::MODE_NETWORK, true, false, $this->getOrder(), $this->session->getLocalUserId());
System::htmlUpdateExit($o);
}