mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-14 18:07:47 +00:00
Remove unused method sendNotificationEmailsToAddressesEmails from NotificationMailer
This commit is contained in:
7
.changes/unreleased/Feature-20260223-164835.yaml
Normal file
7
.changes/unreleased/Feature-20260223-164835.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
kind: Feature
|
||||
body: Send email related to notification in both html and txt format, and render quote correctly
|
||||
time: 2026-02-23T16:48:35.48244838+01:00
|
||||
custom:
|
||||
Issue: "495"
|
||||
MR: "967"
|
||||
SchemaChange: No schema change
|
||||
@@ -59,7 +59,8 @@ readonly class NotificationMailer
|
||||
$email
|
||||
->to($dest->getEmail())
|
||||
->subject('Re: '.$comment->getNotification()->getTitle())
|
||||
->textTemplate('@ChillMain/Notification/email_notification_comment_persist.md.twig')
|
||||
->textTemplate('@ChillMain/Notification/email_notification_comment_persist.txt.twig')
|
||||
->htmlTemplate('@ChillMain/Notification/email_notification_comment_persist.md.twig')
|
||||
->context([
|
||||
'comment' => $comment,
|
||||
'dest' => $dest,
|
||||
@@ -83,7 +84,6 @@ readonly class NotificationMailer
|
||||
public function postPersistNotification(Notification $notification, PostPersistEventArgs $eventArgs): void
|
||||
{
|
||||
$this->sendNotificationEmailsToAddressees($notification);
|
||||
$this->sendNotificationEmailsToAddressesEmails($notification);
|
||||
}
|
||||
|
||||
private function sendNotificationEmailsToAddressees(Notification $notification): void
|
||||
@@ -149,7 +149,8 @@ readonly class NotificationMailer
|
||||
} else {
|
||||
$email = new TemplatedEmail();
|
||||
$email
|
||||
->textTemplate('@ChillMain/Notification/email_non_system_notification_content.md.twig')
|
||||
->textTemplate('@ChillMain/Notification/email_non_system_notification_content.txt.twig')
|
||||
->htmlTemplate('@ChillMain/Notification/email_non_system_notification_content.md.twig')
|
||||
->context([
|
||||
'notification' => $notification,
|
||||
'dest' => $addressee,
|
||||
@@ -186,7 +187,8 @@ readonly class NotificationMailer
|
||||
} else {
|
||||
$email = new TemplatedEmail();
|
||||
$email
|
||||
->textTemplate('@ChillMain/Notification/email_non_system_notification_content.md.twig')
|
||||
->textTemplate('@ChillMain/Notification/email_non_system_notification_content.txt.twig')
|
||||
->htmlTemplate('@ChillMain/Notification/email_non_system_notification_content.md.twig')
|
||||
->context([
|
||||
'notification' => $notification,
|
||||
'dest' => $addressee,
|
||||
@@ -286,38 +288,4 @@ readonly class NotificationMailer
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private function sendNotificationEmailsToAddressesEmails(Notification $notification): void
|
||||
{
|
||||
foreach ($notification->getAddresseeUserGroups() as $userGroup) {
|
||||
|
||||
if (!$userGroup->hasEmail()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$emailAddress = $userGroup->getEmail();
|
||||
|
||||
$email = new TemplatedEmail();
|
||||
$email
|
||||
->textTemplate('@ChillMain/Notification/email_non_system_notification_content_to_email.md.twig')
|
||||
->context([
|
||||
'notification' => $notification,
|
||||
'dest' => $emailAddress,
|
||||
]);
|
||||
|
||||
$email
|
||||
->subject($notification->getTitle())
|
||||
->to($emailAddress);
|
||||
|
||||
try {
|
||||
$this->mailer->send($email);
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->warning('[NotificationMailer] could not send an email notification', [
|
||||
'to' => $emailAddress,
|
||||
'error_message' => $e->getMessage(),
|
||||
'error_trace' => $e->getTraceAsString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
{% apply markdown_to_html %}
|
||||
{{ dest.label }},
|
||||
|
||||
{{ notification.sender.label }} a créé une notification pour vous:
|
||||
|
||||
> {{ notification.title }}
|
||||
>
|
||||
>
|
||||
{%- for line in notification.message|split("\n") %}
|
||||
**Titre de la notification**: {{ notification.title }}
|
||||
|
||||
{% for line in notification.message|split("\n") %}
|
||||
> {{ line }}
|
||||
{%- if not loop.last %}
|
||||
>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
|
||||
Vous pouvez visualiser la notification et y répondre ici:
|
||||
[Vous pouvez visualiser la notification et y répondre ici.]({{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': notification.id }, false)) }})
|
||||
|
||||
{{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': notification.id }, false)) }}
|
||||
-----
|
||||
|
||||
--
|
||||
Le logiciel Chill
|
||||
{% endapply %}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{{ dest.label }},
|
||||
|
||||
{{ notification.sender.label }} a créé une notification pour vous:
|
||||
|
||||
Titre de la notification: {{ notification.title }}
|
||||
|
||||
{% for line in notification.message|split("\n") %}
|
||||
> {{ 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)) }}.
|
||||
|
||||
--
|
||||
Le logiciel Chill
|
||||
@@ -1,20 +0,0 @@
|
||||
{{ dest }},
|
||||
|
||||
{{ notification.sender.label }} a créé une notification pour vous:
|
||||
|
||||
> {{ notification.title }}
|
||||
>
|
||||
>
|
||||
{%- for line in notification.message|split("\n") %}
|
||||
> {{ line }}
|
||||
{%- if not loop.last %}
|
||||
>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
Vous pouvez cliquer sur ce lien pour obtenir un accès permanent à la notification:
|
||||
|
||||
{{ absolute_url(path('chill_main_notification_grant_access_by_access_key', {'_locale': 'fr', 'id': notification.id, 'accessKey': notification.accessKey, 'email': dest})) }}
|
||||
|
||||
--
|
||||
Le logiciel Chill
|
||||
@@ -1,3 +1,4 @@
|
||||
{% apply markdown_to_html %}
|
||||
{{ dest.label }},
|
||||
|
||||
{{ comment.createdBy.label }} a créé un commentaire sur la notification "{{ comment.notification.title }}".
|
||||
@@ -6,14 +7,11 @@ Commentaire:
|
||||
|
||||
{% for line in comment.content|split("\n") %}
|
||||
> {{ line }}
|
||||
{%- if not loop.last %}
|
||||
>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
|
||||
Vous pouvez visualiser la notification et y répondre ici:
|
||||
[Vous pouvez visualiser la notification et y répondre ici.]({{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': comment.notification.id }, false)) }})
|
||||
|
||||
{{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': comment.notification.id }, false)) }}
|
||||
----
|
||||
|
||||
--
|
||||
Le logiciel Chill
|
||||
{% endapply %}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{{ dest.label }},
|
||||
|
||||
{{ comment.createdBy.label }} a créé un commentaire sur la notification "{{ comment.notification.title }}".
|
||||
|
||||
Commentaire:
|
||||
|
||||
{% for line in comment.content|split("\n") %}
|
||||
> {{ line }}
|
||||
{%- endfor %}
|
||||
|
||||
Vous pouvez visualiser la notification et y répondre ici: {{ absolute_url(path('chill_main_notification_show', {'_locale': dest.locale, 'id': comment.notification.id }, false)) }}
|
||||
|
||||
--
|
||||
Le logiciel Chill
|
||||
Reference in New Issue
Block a user