Merge pull request #14437 from annando/network-blank

Avoid blank network page on database issues
This commit is contained in:
Tobias Diekershoff 2024-09-15 09:03:07 +02:00 committed by GitHub
commit 38ff423716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View file

@ -222,7 +222,9 @@ class Network extends Timeline
$o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $this->getOrder(), $this->session->getLocalUserId()); $o .= $this->conversation->render($items, Conversation::MODE_NETWORK, false, false, $this->getOrder(), $this->session->getLocalUserId());
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->error('Exception when fetching items', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
$o .= $this->l10n->t('Error %d (%s) while fetching the timeline.', $e->getCode(), $e->getMessage()); $o .= $this->l10n->t('Error %d (%s) while fetching the timeline.', $e->getCode(), $e->getMessage());
$items = [];
} }
if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'infinite_scroll')) { if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'infinite_scroll')) {

View file

@ -27,12 +27,17 @@ class Network extends NetworkModule
System::htmlUpdateExit($o); System::htmlUpdateExit($o);
} }
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { try {
$items = $this->getChannelItems($request, $this->session->getLocalUserId()); if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
} elseif ($this->community->isTimeline($this->selectedTab)) { $items = $this->getChannelItems($request, $this->session->getLocalUserId());
$items = $this->getCommunityItems(); } elseif ($this->community->isTimeline($this->selectedTab)) {
} else { $items = $this->getCommunityItems();
$items = $this->getItems(); } else {
$items = $this->getItems();
}
} catch (\Exception $e) {
$this->logger->error('Exception when fetching items', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
$items = [];
} }
$o = $this->conversation->render($items, Conversation::MODE_NETWORK, true, false, $this->getOrder(), $this->session->getLocalUserId()); $o = $this->conversation->render($items, Conversation::MODE_NETWORK, true, false, $this->getOrder(), $this->session->getLocalUserId());