From f1fa1f0b6290c14032db48d3084846e2ddd1bc19 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Sep 2023 08:17:31 +0000 Subject: [PATCH] Further improvements to the automatic update process --- src/Module/Conversation/Network.php | 4 ++-- src/Module/Conversation/Timeline.php | 5 ++++- src/Module/Update/Channel.php | 2 +- src/Module/Update/Community.php | 2 +- src/Module/Update/Network.php | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 63da5717a..1d6dc86c3 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -348,9 +348,9 @@ class Network extends Timeline $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. - if ($this->force && ($this->selectedTab == TimelineEntity::COMMENTED) && !empty($request['first_commented'])) { + if ($this->update && ($this->selectedTab == TimelineEntity::COMMENTED)) { $this->order = 'received'; } diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index ac67be957..d685013ba 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -64,6 +64,8 @@ class Timeline extends BaseModule protected $noSharer; /** @var bool */ protected $force; + /** @var bool */ + protected $update; /** @var App\Mode $mode */ protected $mode; @@ -131,7 +133,8 @@ class Timeline extends BaseModule $this->maxId = $request['max_id'] ?? null; $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 diff --git a/src/Module/Update/Channel.php b/src/Module/Update/Channel.php index 223666739..ac35d9c26 100644 --- a/src/Module/Update/Channel.php +++ b/src/Module/Update/Channel.php @@ -37,7 +37,7 @@ class Channel extends ChannelModule $this->parseRequest($request); $o = ''; - if ($this->force) { + if ($this->update || $this->force) { if ($this->timeline->isChannel($this->selectedTab)) { $items = $this->getChannelItems(); } else { diff --git a/src/Module/Update/Community.php b/src/Module/Update/Community.php index 31f75d24e..05ea8f828 100644 --- a/src/Module/Update/Community.php +++ b/src/Module/Update/Community.php @@ -39,7 +39,7 @@ class Community extends CommunityModule $this->parseRequest($request); $o = ''; - if ($this->force) { + if ($this->update || $this->force) { $o = DI::conversation()->render($this->getCommunityItems(), Conversation::MODE_COMMUNITY, true, false, 'commented', DI::userSession()->getLocalUserId()); } diff --git a/src/Module/Update/Network.php b/src/Module/Update/Network.php index 5f7f234e0..e8a2dce07 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -37,7 +37,7 @@ class Network extends NetworkModule $o = ''; - if (!$this->force) { + if (!$this->update && !$this->force) { System::htmlUpdateExit($o); }