Skip to content

Commit

Permalink
Prevent Same value for different contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzmany committed Feb 17, 2020
1 parent 510c369 commit c85666b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions EventListener/EmailSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function __construct(TemplateProcessor $templateProcessor)
public static function getSubscribedEvents()
{
return [
EmailEvents::EMAIL_ON_SEND => ['onEmailGenerate', 0],
EmailEvents::EMAIL_ON_DISPLAY => ['onEmailGenerate', 0]
EmailEvents::EMAIL_ON_SEND => ['onEmailGenerate', 300],
EmailEvents::EMAIL_ON_DISPLAY => ['onEmailGenerate', 0],
];
}

Expand All @@ -52,7 +52,7 @@ public static function getSubscribedEvents()
public function onEmailGenerate(Events\EmailSendEvent $event)
{
$this->logger->info('onEmailGenerate MauticAdvancedTemplatesBundle\EmailSubscriber');
$content = $event->getContent();
$content = $event->getEmail()->getCustomHtml();
$content = $this->templateProcessor->processTemplate($content, $event->getLead());
$event->setContent($content);
if ( empty( trim($event->getPlainText()) ) ) {
Expand Down

2 comments on commit c85666b

@arashsoheili
Copy link

@arashsoheili arashsoheili commented on c85666b Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kuzmany We are noticing same value for different contact when viewing email in browser. The actual emails are correct but the viewed emails are wrong. Any insight into why this would happen. What does the 300 change due on EmailEvents::EMAIL_ON_SEND

@martinstadelmann
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arashsoheili The 300 is the priority of the event. This changed the order when the actual generation of the email happens.

I tried some stuff with EmailEvents::EMAIL_ON_DISPLAY however it is not actually called when requesting the web view but rather when previewing the email. So there must be an issue with how web views are saved to the database.

I've created a new issue ( #17 ).

Please sign in to comment.