Further improvements to the automatic update process

This commit is contained in:
Michael 2023-09-17 08:17:31 +00:00
parent e81c911b49
commit f1fa1f0b62
5 changed files with 9 additions and 6 deletions

View File

@ -348,9 +348,9 @@ class Network extends Timeline
$this->order = 'commented'; $this->order = 'commented';
} }
// Upon force (updates in the background) and order by last comment we order by receive date, // Upon updates in the background and order by last comment we order by receive date,
// since otherwise the feed will optically jump, when some already visible thread has been updated. // since otherwise the feed will optically jump, when some already visible thread has been updated.
if ($this->force && ($this->selectedTab == TimelineEntity::COMMENTED) && !empty($request['first_commented'])) { if ($this->update && ($this->selectedTab == TimelineEntity::COMMENTED)) {
$this->order = 'received'; $this->order = 'received';
} }

View File

@ -64,6 +64,8 @@ class Timeline extends BaseModule
protected $noSharer; protected $noSharer;
/** @var bool */ /** @var bool */
protected $force; protected $force;
/** @var bool */
protected $update;
/** @var App\Mode $mode */ /** @var App\Mode $mode */
protected $mode; protected $mode;
@ -131,7 +133,8 @@ class Timeline extends BaseModule
$this->maxId = $request['max_id'] ?? null; $this->maxId = $request['max_id'] ?? null;
$this->noSharer = !empty($request['no_sharer']); $this->noSharer = !empty($request['no_sharer']);
$this->force = !empty($request['force']); $this->force = !empty($request['force']) && !empty($request['item']);
$this->update = !empty($request['force']) && !empty($request['first_received']) && !empty($request['first_created']) && !empty($request['first_uriid']) && !empty($request['first_commented']);
} }
protected function getNoSharerWidget(string $base): string protected function getNoSharerWidget(string $base): string

View File

@ -37,7 +37,7 @@ class Channel extends ChannelModule
$this->parseRequest($request); $this->parseRequest($request);
$o = ''; $o = '';
if ($this->force) { if ($this->update || $this->force) {
if ($this->timeline->isChannel($this->selectedTab)) { if ($this->timeline->isChannel($this->selectedTab)) {
$items = $this->getChannelItems(); $items = $this->getChannelItems();
} else { } else {

View File

@ -39,7 +39,7 @@ class Community extends CommunityModule
$this->parseRequest($request); $this->parseRequest($request);
$o = ''; $o = '';
if ($this->force) { if ($this->update || $this->force) {
$o = DI::conversation()->render($this->getCommunityItems(), Conversation::MODE_COMMUNITY, true, false, 'commented', DI::userSession()->getLocalUserId()); $o = DI::conversation()->render($this->getCommunityItems(), Conversation::MODE_COMMUNITY, true, false, 'commented', DI::userSession()->getLocalUserId());
} }

View File

@ -37,7 +37,7 @@ class Network extends NetworkModule
$o = ''; $o = '';
if (!$this->force) { if (!$this->update && !$this->force) {
System::htmlUpdateExit($o); System::htmlUpdateExit($o);
} }