From 89c1334564311dee690d03604782eba08720734c Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Sat, 14 Sep 2024 00:56:08 +0200 Subject: [PATCH] Check if EntryComment is defined and not null (#1129) --- templates/entry/comment/view.html.twig | 24 ++++++++++++++++++------ translations/messages.en.yaml | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/templates/entry/comment/view.html.twig b/templates/entry/comment/view.html.twig index 5538e09e5..7ad9accad 100644 --- a/templates/entry/comment/view.html.twig +++ b/templates/entry/comment/view.html.twig @@ -46,11 +46,23 @@ }) }}" data-controller="subject-list" data-action="{{- DYNAMIC_LISTS is same as V_TRUE ? autoAction : manualAction -}}"> - {{ component('entry_comment', { - comment: comment.root ?? comment, - showEntryTitle: false, - showMagazineName: false, - showNested: true, - }) }} + {% set entryComment = comment.root ?? comment %} + {% if entryComment is defined and entryComment is not null %} + {{ component('entry_comment', { + comment: entryComment, + showEntryTitle: false, + showMagazineName: false, + showNested: true, + }) }} + {% else %} +
+

+ + {{ 'back'|trans }} + + {{ 'comment_not_found'|trans }} +

+
+ {% endif %} {% endblock %} diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 7ac3e3890..d58507727 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -896,3 +896,4 @@ admin_users_suspended: Suspended admin_users_banned: Banned user_verify: Activate account max_image_size: Maximum file size +comment_not_found: Comment not found