From f12bc2f35f7c464ac28409125d8916d7e55ac270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 18 Mar 2026 08:16:40 +0000 Subject: [PATCH] Fix notification email links to handle user and non-user contexts --- .changes/unreleased/Fixed-20260318-090323.yaml | 7 +++++++ .../Notification/Email/NotificationMailer.php | 3 +++ .../email_non_system_notification_content.md.twig | 5 +++++ .../email_non_system_notification_content.txt.twig | 6 +++++- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixed-20260318-090323.yaml diff --git a/.changes/unreleased/Fixed-20260318-090323.yaml b/.changes/unreleased/Fixed-20260318-090323.yaml new file mode 100644 index 000000000..f50b1a752 --- /dev/null +++ b/.changes/unreleased/Fixed-20260318-090323.yaml @@ -0,0 +1,7 @@ +kind: Fixed +body: Fix link inside notification email +time: 2026-03-18T09:03:23.896160821+01:00 +custom: + Issue: "" + MR: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index c1eb03c49..3a02cc38a 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -101,6 +101,9 @@ class NotificationMailer if (null === $addressee->getEmail()) { continue; } + if ($notification->getSender() === $addressee) { + continue; + } $this->processNotificationForAddressee($notification, $addressee); } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.md.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.md.twig index 854547c92..177bb1b0e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.md.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.md.twig @@ -13,7 +13,12 @@ > {{ line }} {% endfor %} +{% if dest.isUser %} [Vous pouvez visualiser la notification et y répondre ici.]({{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': notification.id }, false)) }}) +{% else %} +[Vous pouvez visualiser la notification et y répondre ici.]({{ absolute_url(path('chill_main_notification_grant_access_by_access_key', {'_locale': dest.locale, 'id': notification.id, 'accessKey': notification.accessKey }, false)) }}) +{% endif %} + ----- diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.txt.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.txt.twig index b14f77ef7..48afa1be1 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.txt.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/email_non_system_notification_content.txt.twig @@ -12,7 +12,11 @@ Titre de la notification: {{ notification.title }} > {{ line|raw }} {% endfor %} -Vous pouvez visualiser la notification et y répondre ici: {{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': notification.id }, false)) }}. +{% if dest.isUser %} +[Vous pouvez visualiser la notification et y répondre ici.]({{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': notification.id }, false)) }}) +{% else %} +[Vous pouvez visualiser la notification et y répondre ici.]({{ absolute_url(path('chill_main_notification_grant_access_by_access_key', {'_locale': dest.locale, 'id': notification.id, 'accessKey': notification.accessKey }, false)) }}) +{% endif %} -- Le logiciel Chill