From 525eab395cf4f5883ea50e5584c9a05b7b7e5325 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 18 Nov 2022 20:44:53 -0500 Subject: [PATCH 1/2] Improve error message when conversation isn't available in Module\Item\Display - 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 | 12 ++++++++++-- view/templates/exception.tpl | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Module/Item/Display.php b/src/Module/Item/Display.php index 42112a3e02..df500f7ccb 100644 --- a/src/Module/Item/Display.php +++ b/src/Module/Item/Display.php @@ -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.

+

Possible reasons include:

+

')); } $item['uri-id'] = $item['parent-uri-id']; diff --git a/view/templates/exception.tpl b/view/templates/exception.tpl index 0456136bc4..ad1a15f878 100644 --- a/view/templates/exception.tpl +++ b/view/templates/exception.tpl @@ -1,7 +1,7 @@

{{$title}}

-

{{$message}}

+

{{$message nofilter}}

{{if $thrown}}
{{$thrown}}
 {{$stack_trace}}

From 0c8242af642a11afd868cdd6631cbb5840d68643 Mon Sep 17 00:00:00 2001
From: Hypolite Petovan 
Date: Sat, 19 Nov 2022 07:50:07 -0500
Subject: [PATCH 2/2] Update main translation file after adding a string

---
 view/lang/C/messages.po | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po
index 0428ba5900..cbd26b59a4 100644
--- a/view/lang/C/messages.po
+++ b/view/lang/C/messages.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 2022.12-dev\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-11-19 07:52-0500\n"
+"POT-Creation-Date: 2022-11-19 12:01-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME \n"
 "Language-Team: LANGUAGE \n"
@@ -7089,11 +7089,24 @@ msgid ""
 "Theme Customization settings."
 msgstr ""
 
-#: src/Module/Item/Display.php:135 src/Module/Item/Display.php:252
-#: src/Module/Update/Display.php:55
+#: src/Module/Item/Display.php:135 src/Module/Update/Display.php:55
 msgid "The requested item doesn't exist or has been deleted."
 msgstr ""
 
+#: src/Module/Item/Display.php:253
+msgid ""
+"Unfortunately, the requested conversation isn't available to you.

\n" +"

Possible reasons include:

\n" +"
    \n" +"\t
  • The top-level post isn't visible.
  • \n" +"\t
  • The top-level post was deleted.
  • \n" +"\t
  • The node has blocked the top-level author or the author of the shared " +"post.
  • \n" +"\t
  • You have ignored or blocked the top-level author or the author of the " +"shared post.
  • \n" +"

" +msgstr "" + #: src/Module/Item/Feed.php:86 msgid "The feed for this item is unavailable." msgstr ""