Skip to content

Commit

Permalink
Change MessageEventSubscriber logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumazeau committed Jan 19, 2023
1 parent bd2e12c commit 15d7981
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/Infrastructure/EventSubscriber/MessageEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,20 @@ public function onMessage(MessageEvent $event): void
{
$message = $event->getMessage();

if (!$message instanceof Email || $event->isQueued()) {
if (!$message instanceof Email) {
return;
}

($this->senderEmailUpdater)($message);
($this->returnPathEmailUpdater)($message);
($this->bccEmailUpdater)($message);
($this->footerEmailUpdater)($message);
($this->returnPathEmailUpdater)($message);
($this->senderEmailUpdater)($message);
($this->subjectPrefixEmailUpdater)($message);

if ($event->isQueued()) {
return;
}

($this->yopmailTransformerEmailUpdater)($message);
($this->bccTransformerEmailUpdater)($message);
}
Expand Down
12 changes: 9 additions & 3 deletions src/Infrastructure/Resources/views/bcc_tranformation.html.twig
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<div style="background: #eeeeee; padding: 15px">
<div>{{ 'mailer_bundle.transformation.to'|trans({}, 'messages') }} {{ toList|join(' / ') }}</div><br/>
<div>{{ 'mailer_bundle.transformation.to'|trans({}, 'messages') }} {{ toList|join(' / ') }}</div>

<div>{{ 'mailer_bundle.transformation.cc'|trans({}, 'messages') }} {{ ccList|join(' / ') }}</div><br/>
{% if ccList is not empty %}
<br/>
<div>{{ 'mailer_bundle.transformation.cc'|trans({}, 'messages') }} {{ ccList|join(' / ') }}</div>
{% endif %}

<div>{{ 'mailer_bundle.transformation.bcc'|trans({}, 'messages') }} {{ bccList|join(' / ') }}</div>
{% if bccList is not empty %}
<br/>
<div>{{ 'mailer_bundle.transformation.bcc'|trans({}, 'messages') }} {{ bccList|join(' / ') }}</div>
{% endif %}
</div>
<br/>
<br/>

0 comments on commit 15d7981

Please sign in to comment.