mirror of
https://github.com/friendica/friendica
synced 2024-12-22 23:20:16 +00:00
Centralised function for the sort order
This commit is contained in:
parent
19dfdbc03f
commit
ab235e24ad
2 changed files with 13 additions and 20 deletions
|
@ -238,15 +238,7 @@ class Network extends Timeline
|
|||
$o .= Profile::getEventsReminderHTML();
|
||||
}
|
||||
|
||||
if (self::$order === 'received') {
|
||||
$ordering = '`received`';
|
||||
} elseif (self::$order === 'created') {
|
||||
$ordering = '`created`';
|
||||
} else {
|
||||
$ordering = '`commented`';
|
||||
}
|
||||
|
||||
$o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $ordering, $this->session->getLocalUserId());
|
||||
$o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $this->getOrder(), $this->session->getLocalUserId());
|
||||
|
||||
if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'infinite_scroll')) {
|
||||
$o .= HTML::scrollLoader();
|
||||
|
@ -265,6 +257,17 @@ class Network extends Timeline
|
|||
return $o;
|
||||
}
|
||||
|
||||
protected function getOrder(): string
|
||||
{
|
||||
if (self::$order === 'received') {
|
||||
return '`received`';
|
||||
} elseif (self::$order === 'created') {
|
||||
return '`created`';
|
||||
} else {
|
||||
return '`commented`';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets items as seen
|
||||
*
|
||||
|
|
|
@ -43,17 +43,7 @@ class Network extends NetworkModule
|
|||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
||||
$items = $this->getItems();
|
||||
|
||||
if (self::$order === 'received') {
|
||||
$ordering = '`received`';
|
||||
} elseif (self::$order === 'created') {
|
||||
$ordering = '`created`';
|
||||
} else {
|
||||
$ordering = '`commented`';
|
||||
}
|
||||
|
||||
$o = $this->conversation->render($items, Conversation::MODE_NETWORK, $profile_uid, false, $ordering, $this->session->getLocalUserId());
|
||||
$o = $this->conversation->render($this->getItems(), Conversation::MODE_NETWORK, $profile_uid, false, $this->getOrder(), $this->session->getLocalUserId());
|
||||
|
||||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue