]> git.mxchange.org Git - friendica.git/commitdiff
Fix DisplayNotFound page
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 18 Jul 2023 02:55:46 +0000 (22:55 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 20 Aug 2023 18:26:27 +0000 (14:26 -0400)
- Add another condition earlier in Module\Item\Display
- Separate reasons in individual translation strings

src/Module/Item/Display.php
src/Module/Special/DisplayNotFound.php
view/templates/special/displaynotfound.tpl

index 21046628feff566c4d58fd21ec553f46d7e44605..714598a8e66814fa896c0e27010526749f58b5a0 100644 (file)
@@ -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) {
index d66ececdd081c6c4f9208fe5cb41c4200546d7e7..009c3241f9ed034df59ca2e7f36e20ece83fe219 100644 (file)
@@ -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("<p>Unfortunately, the requested conversation isn't available to you.</p>
-<p>Possible reasons include:</p>
-<ul>
-       <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>"),
+                               '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,
                        ]
                ]);
        }
index 48e7b5166d529f7d0e4b3da39f5fad20b014cc01..a690f87c4d85c1f4f6edcae039cddf11e0890a70 100644 (file)
@@ -1,5 +1,11 @@
 <div id="exception" class="generic-page-wrapper">
        <img class="hare" src="images/friendica-404_svg_flexy-o-hare.png"/>
-       <h1>{{$title}}</h1>
-       {{$message nofilter}}
+       <h1>{{$l10n.title}}</h1>
+       <p>{{$l10n.desc1}}</p>
+       <p>{{$l10n.desc2}}</p>
+       <ul>
+{{foreach $l10n.reasons as $reason}}
+               <li>{{$reason}}</li>
+{{/foreach}}
+       </ul>
 </div>