From 63f5d94a02cda0fde6d8d494314d02b4e634f51f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 17 Jul 2023 22:55:46 -0400 Subject: [PATCH] Fix DisplayNotFound page - Add another condition earlier in Module\Item\Display - Separate reasons in individual translation strings --- src/Module/Item/Display.php | 4 +++- src/Module/Special/DisplayNotFound.php | 20 +++++++++++--------- view/templates/special/displaynotfound.tpl | 10 ++++++++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Module/Item/Display.php b/src/Module/Item/Display.php index 21046628f..714598a8e 100644 --- a/src/Module/Item/Display.php +++ b/src/Module/Item/Display.php @@ -133,7 +133,9 @@ class Display extends BaseModule } if (empty($item)) { - throw new HTTPException\NotFoundException($this->t('The requested item doesn\'t exist or has been deleted.')); + $this->page['aside'] = ''; + $displayNotFound = new DisplayNotFound($this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters); + return $displayNotFound->content(); } if ($item['gravity'] != Item::GRAVITY_PARENT) { diff --git a/src/Module/Special/DisplayNotFound.php b/src/Module/Special/DisplayNotFound.php index d66ececdd..009c3241f 100644 --- a/src/Module/Special/DisplayNotFound.php +++ b/src/Module/Special/DisplayNotFound.php @@ -31,18 +31,20 @@ class DisplayNotFound extends \Friendica\BaseModule { protected function content(array $request = []): string { + $reasons = [ + $this->t("The top-level post isn't visible."), + $this->t('The top-level post was deleted.'), + $this->t('This node has blocked the top-level author or the author of the shared post.'), + $this->t('You have ignored or blocked the top-level author or the author of the shared post.'), + ]; + $tpl = Renderer::getMarkupTemplate('special/displaynotfound.tpl'); return Renderer::replaceMacros($tpl, [ '$l10n' => [ - 'title' => $this->t('Not Found'), - 'message' => $this->t("

Unfortunately, the requested conversation isn't available to you.

-

Possible reasons include:

-"), + 'title' => $this->t('Conversation Not Found'), + 'desc1' => $this->t("Unfortunately, the requested conversation isn't available to you."), + 'desc2' => $this->t('Possible reasons include:'), + 'reasons' => $reasons, ] ]); } diff --git a/view/templates/special/displaynotfound.tpl b/view/templates/special/displaynotfound.tpl index 48e7b5166..a690f87c4 100644 --- a/view/templates/special/displaynotfound.tpl +++ b/view/templates/special/displaynotfound.tpl @@ -1,5 +1,11 @@
-

{{$title}}

- {{$message nofilter}} +

{{$l10n.title}}

+

{{$l10n.desc1}}

+

{{$l10n.desc2}}

+