From 53228984e822352deb7490a84faa12cf82cdcacf Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Fri, 13 Sep 2024 14:37:44 +0200 Subject: [PATCH 1/5] Check if EntryComment is defined and not null...?EntryComment can be null after all during the __invoke --- templates/entry/comment/view.html.twig | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/templates/entry/comment/view.html.twig b/templates/entry/comment/view.html.twig index 5538e09e5..4423f570c 100644 --- a/templates/entry/comment/view.html.twig +++ b/templates/entry/comment/view.html.twig @@ -41,16 +41,20 @@ {% set autoAction = 'notifications:EntryCommentCreatedNotification@window->subject-list#addComment' %} {% set manualAction = 'notifications:EntryCommentCreatedNotification@window->subject-list#increaseCounter' %} -
- {{ 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, + }) }} +
+ {% endif %} {% endblock %} From 6f725b4bbddffb4c4c6d639803a86d9767a72616 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Fri, 13 Sep 2024 18:35:35 +0200 Subject: [PATCH 2/5] Show error in case of empty entry comment --- templates/entry/comment/view.html.twig | 26 +++++++++++++++++--------- translations/messages.en.yaml | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/templates/entry/comment/view.html.twig b/templates/entry/comment/view.html.twig index 4423f570c..a7d0784d5 100644 --- a/templates/entry/comment/view.html.twig +++ b/templates/entry/comment/view.html.twig @@ -41,20 +41,28 @@ {% set autoAction = 'notifications:EntryCommentCreatedNotification@window->subject-list#addComment' %} {% set manualAction = 'notifications:EntryCommentCreatedNotification@window->subject-list#increaseCounter' %} - - {% set entryComment = comment.root ?? comment %} - {% if entryComment is defined and entryComment is not null %} -
+
+ {% 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 %} + {% 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 From 6bbce3561be14a3aa6fdb2d5069b7f7c9bcf05c4 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Fri, 13 Sep 2024 18:38:26 +0200 Subject: [PATCH 3/5] Close i --- templates/entry/comment/view.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/entry/comment/view.html.twig b/templates/entry/comment/view.html.twig index a7d0784d5..934dd9b62 100644 --- a/templates/entry/comment/view.html.twig +++ b/templates/entry/comment/view.html.twig @@ -58,7 +58,7 @@

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

From 6384f430a751496524c3ce329847ab2c2886ea19 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Fri, 13 Sep 2024 18:39:29 +0200 Subject: [PATCH 4/5] Add an extra space --- templates/entry/comment/view.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/entry/comment/view.html.twig b/templates/entry/comment/view.html.twig index 934dd9b62..34d54639f 100644 --- a/templates/entry/comment/view.html.twig +++ b/templates/entry/comment/view.html.twig @@ -60,7 +60,7 @@ {{ 'back'|trans }} - {{ 'comment_not_found'|trans }} +   {{ 'comment_not_found'|trans }}

{% endif %} From a43f0c23a82dd9f3b9d76abe40520d654eeb7b43 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Sat, 14 Sep 2024 00:16:55 +0200 Subject: [PATCH 5/5] Update view.html.twig --- templates/entry/comment/view.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/entry/comment/view.html.twig b/templates/entry/comment/view.html.twig index 34d54639f..7ad9accad 100644 --- a/templates/entry/comment/view.html.twig +++ b/templates/entry/comment/view.html.twig @@ -57,10 +57,10 @@ {% else %}

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

{% endif %}