Fix DisplayNotFound page

- Add another condition earlier in Module\Item\Display
- Separate reasons in individual translation strings
This commit is contained in:
Hypolite Petovan 2023-07-17 22:55:46 -04:00
parent 96d2cddb54
commit 63f5d94a02
3 changed files with 22 additions and 12 deletions

View file

@ -133,7 +133,9 @@ class Display extends BaseModule
} }
if (empty($item)) { 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) { if ($item['gravity'] != Item::GRAVITY_PARENT) {

View file

@ -31,18 +31,20 @@ class DisplayNotFound extends \Friendica\BaseModule
{ {
protected function content(array $request = []): string 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'); $tpl = Renderer::getMarkupTemplate('special/displaynotfound.tpl');
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
'$l10n' => [ '$l10n' => [
'title' => $this->t('Not Found'), 'title' => $this->t('Conversation Not Found'),
'message' => $this->t("<p>Unfortunately, the requested conversation isn't available to you.</p> 'desc1' => $this->t("Unfortunately, the requested conversation isn't available to you."),
<p>Possible reasons include:</p> 'desc2' => $this->t('Possible reasons include:'),
<ul> 'reasons' => $reasons,
<li>The top-level post isn't visible.</li>
<li>The top-level post was deleted.</li>
<li>The node has blocked the top-level author or the author of the shared post.</li>
<li>You have ignored or blocked the top-level author or the author of the shared post.</li>
</ul>"),
] ]
]); ]);
} }

View file

@ -1,5 +1,11 @@
<div id="exception" class="generic-page-wrapper"> <div id="exception" class="generic-page-wrapper">
<img class="hare" src="images/friendica-404_svg_flexy-o-hare.png"/> <img class="hare" src="images/friendica-404_svg_flexy-o-hare.png"/>
<h1>{{$title}}</h1> <h1>{{$l10n.title}}</h1>
{{$message nofilter}} <p>{{$l10n.desc1}}</p>
<p>{{$l10n.desc2}}</p>
<ul>
{{foreach $l10n.reasons as $reason}}
<li>{{$reason}}</li>
{{/foreach}}
</ul>
</div> </div>