]> git.mxchange.org Git - friendica.git/commitdiff
Improve error message when conversation isn't available in Module\Item\Display
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 19 Nov 2022 01:44:53 +0000 (20:44 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 19 Nov 2022 17:29:08 +0000 (12:29 -0500)
- Retrieve the parent post no matter what. Previously it was depending on the user's settings, which gave unpredictable behavior if the parent post wasn't retrieved for whatever reason.
- List possible reasons the conversation isn't showing up based on the condition in Model\Post::selectViewForUser
- Allow HTML in exception messages

src/Module/Item/Display.php
view/templates/exception.tpl

index 42112a3e0253bd432d979b1c407d2fdf5e76cafb..df500f7ccb4aedd31a95b52b9c82c8cefc0cfe04 100644 (file)
@@ -136,7 +136,7 @@ class Display extends BaseModule
                }
 
                if ($item['gravity'] != Item::GRAVITY_PARENT) {
-                       $parent = Post::selectFirstForUser($itemUid, $fields, [
+                       $parent = Post::selectFirst($fields, [
                                'uid'    => [0, $itemUid],
                                'uri-id' => $item['parent-uri-id']
                        ], ['order' => ['uid' => true]]);
@@ -249,7 +249,15 @@ class Display extends BaseModule
                $item = Post::selectFirstForUser($pageUid, $fields, $condition);
 
                if (empty($item)) {
-                       throw new HTTPException\NotFoundException($this->t('The requested item doesn\'t exist or has been deleted.'));
+                       $this->page['aside'] = '';
+                       throw new HTTPException\NotFoundException($this->t('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><p>'));
                }
 
                $item['uri-id'] = $item['parent-uri-id'];
index 0456136bc48aafeee8091f873cd2c8e3dbe4eaf5..ad1a15f878b51fd607b2879cc36750c3a2db9518 100644 (file)
@@ -1,7 +1,7 @@
 <div id="exception" class="generic-page-wrapper">
     <img class="hare" src="images/friendica-404_svg_flexy-o-hare.png"/>
     <h1>{{$title}}</h1>
-    <p>{{$message}}</p>
+    <p>{{$message nofilter}}</p>
 {{if $thrown}}
        <pre>{{$thrown}}
 {{$stack_trace}}