Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M3 changed to flush queue before cc and bcc are cleared #8768

Merged
merged 4 commits into from May 15, 2020
Merged

M3 changed to flush queue before cc and bcc are cleared #8768

merged 4 commits into from May 15, 2020

Conversation

hluchas
Copy link
Contributor

@hluchas hluchas commented May 7, 2020

Q A
Bug fix? Y
New feature?
Automated tests included?
Related user documentation PR URL
Related developer documentation PR URL
Issues addressed (#s or URLs)
BC breaks?
Deprecations?

Description:

Fixing bug where cc and bcc emails are not sent from the Send to User campaign action. This is required for fixing the Selenium tests. We also want to avoid regressing the bug where the cc and bcc emails could get sent multiple times if there is more than one email in the 'To' field.

Steps to reproduce the bug:

  1. Create a campaign with action 'Send Email to User'
  2. In the action, add 2 unique emails each to the 'To', 'Cc' and 'Bcc' fields
  3. Trigger the campaign action
  4. Check that each email address receives exactly one email

Steps to test this PR:

  1. Load up this PR
  2. Repeat reproduction steps

@hluchas hluchas added the bug Issues or PR's relating to bugs label May 7, 2020
@escopecz escopecz added this to the 3.0.0 milestone May 7, 2020
@escopecz escopecz added this to Needs code review and/or test in Mautic 3 May 7, 2020
@hluchas hluchas added the ready-to-test PR's that are ready to test label May 7, 2020
@dennisameling dennisameling self-requested a review May 12, 2020 20:22
Copy link
Member

@dennisameling dennisameling left a comment

Choose a reason for hiding this comment

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

@hluchas
I'm seeing PHP notices after applying your PR. However, the functionality itself works as expected (all email addresses receive the email just once, this is the case before and after applying the PR). I used an SMTP server for testing.

dennis@mautic3dennis-web:/var/www/html$ bin/console mautic:campaigns:trigger
Triggering events for campaign 2
Triggering events for newly added contacts
1 total events(s) to be processed in batches of 100 contacts
 1/1 [============================] 100%PHP Notice:  Array to string conversion in /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php on line 60
PHP Stack trace:
PHP   1. {main}() /var/www/html/bin/console:0
PHP   2. Symfony\Bundle\FrameworkBundle\Console\Application->run() /var/www/html/bin/console:43
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/console/Application.php:148
PHP   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:74
PHP   5. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/console/Application.php:255
PHP   6. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:86
PHP   7. Mautic\CampaignBundle\Command\TriggerCampaignCommand->run() /var/www/html/vendor/symfony/console/Application.php:1005
PHP   8. Mautic\CampaignBundle\Command\TriggerCampaignCommand->execute() /var/www/html/vendor/symfony/console/Command/Command.php:255
PHP   9. Mautic\CampaignBundle\Command\TriggerCampaignCommand->triggerCampaign() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:277
PHP  10. Mautic\CampaignBundle\Command\TriggerCampaignCommand->executeKickoff() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:328
PHP  11. Mautic\CampaignBundle\Executioner\KickoffExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:372
PHP  12. Mautic\CampaignBundle\Executioner\KickoffExecutioner->executeOrScheduleEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:122
PHP  13. Mautic\CampaignBundle\Executioner\EventExecutioner->executeEventsForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:222
PHP  14. Mautic\CampaignBundle\Executioner\EventExecutioner->executeForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:245
PHP  15. Mautic\CampaignBundle\Executioner\EventExecutioner->executeLogs() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:172
PHP  16. Mautic\CampaignBundle\Executioner\Event\ActionExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:201
PHP  17. Mautic\CampaignBundle\Executioner\Dispatcher\ActionDispatcher->dispatchEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/Event/ActionExecutioner.php:67
PHP  18. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /var/www/html/app/bundles/CampaignBundle/Executioner/Dispatcher/ActionDispatcher.php:89
PHP  19. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->doDispatch() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:44
PHP  20. Mautic\EmailBundle\EventListener\CampaignSubscriber->onCampaignTriggerActionSendEmailToUser() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:214
PHP  21. Mautic\EmailBundle\Model\SendEmailToUser->sendEmailToUsers() /var/www/html/app/bundles/EmailBundle/EventListener/CampaignSubscriber.php:377
PHP  22. implode() /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php:60

Notice: Array to string conversion in /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php on line 60

Call Stack:
    0.0011     401352   1. {main}() /var/www/html/bin/console:0
    0.0613    1240848   2. Symfony\Bundle\FrameworkBundle\Console\Application->run() /var/www/html/bin/console:43
    0.0697    1400264   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/console/Application.php:148
    0.5348    9746328   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:74
    0.5350    9746944   5. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/console/Application.php:255
    0.5350    9746944   6. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:86
    0.5366    9755744   7. Mautic\CampaignBundle\Command\TriggerCampaignCommand->run() /var/www/html/vendor/symfony/console/Application.php:1005
    0.5370    9757464   8. Mautic\CampaignBundle\Command\TriggerCampaignCommand->execute() /var/www/html/vendor/symfony/console/Command/Command.php:255
    0.5751   10515776   9. Mautic\CampaignBundle\Command\TriggerCampaignCommand->triggerCampaign() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:277
    0.5756   10517152  10. Mautic\CampaignBundle\Command\TriggerCampaignCommand->executeKickoff() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:328
    0.5758   10517152  11. Mautic\CampaignBundle\Executioner\KickoffExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:372
    0.5936   10790328  12. Mautic\CampaignBundle\Executioner\KickoffExecutioner->executeOrScheduleEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:122
    0.6306   11249224  13. Mautic\CampaignBundle\Executioner\EventExecutioner->executeEventsForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:222
    0.6314   11251472  14. Mautic\CampaignBundle\Executioner\EventExecutioner->executeForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:245
    0.8167   13045208  15. Mautic\CampaignBundle\Executioner\EventExecutioner->executeLogs() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:172
    0.8168   13045208  16. Mautic\CampaignBundle\Executioner\Event\ActionExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:201
    0.8168   13045232  17. Mautic\CampaignBundle\Executioner\Dispatcher\ActionDispatcher->dispatchEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/Event/ActionExecutioner.php:67
    0.8180   13050496  18. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /var/www/html/app/bundles/CampaignBundle/Executioner/Dispatcher/ActionDispatcher.php:89
    0.8180   13050256  19. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->doDispatch() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:44
    0.8180   13050256  20. Mautic\EmailBundle\EventListener\CampaignSubscriber->onCampaignTriggerActionSendEmailToUser() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:214
    0.8181   13050872  21. Mautic\EmailBundle\Model\SendEmailToUser->sendEmailToUsers() /var/www/html/app/bundles/EmailBundle/EventListener/CampaignSubscriber.php:377
    1.4253   14446608  22. implode() /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php:60

PHP Notice:  Array to string conversion in /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php on line 60
PHP Stack trace:
PHP   1. {main}() /var/www/html/bin/console:0
PHP   2. Symfony\Bundle\FrameworkBundle\Console\Application->run() /var/www/html/bin/console:43
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/console/Application.php:148
PHP   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:74
PHP   5. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/console/Application.php:255
PHP   6. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:86
PHP   7. Mautic\CampaignBundle\Command\TriggerCampaignCommand->run() /var/www/html/vendor/symfony/console/Application.php:1005
PHP   8. Mautic\CampaignBundle\Command\TriggerCampaignCommand->execute() /var/www/html/vendor/symfony/console/Command/Command.php:255
PHP   9. Mautic\CampaignBundle\Command\TriggerCampaignCommand->triggerCampaign() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:277
PHP  10. Mautic\CampaignBundle\Command\TriggerCampaignCommand->executeKickoff() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:328
PHP  11. Mautic\CampaignBundle\Executioner\KickoffExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:372
PHP  12. Mautic\CampaignBundle\Executioner\KickoffExecutioner->executeOrScheduleEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:122
PHP  13. Mautic\CampaignBundle\Executioner\EventExecutioner->executeEventsForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:222
PHP  14. Mautic\CampaignBundle\Executioner\EventExecutioner->executeForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:245
PHP  15. Mautic\CampaignBundle\Executioner\EventExecutioner->executeLogs() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:172
PHP  16. Mautic\CampaignBundle\Executioner\Event\ActionExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:201
PHP  17. Mautic\CampaignBundle\Executioner\Dispatcher\ActionDispatcher->dispatchEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/Event/ActionExecutioner.php:67
PHP  18. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /var/www/html/app/bundles/CampaignBundle/Executioner/Dispatcher/ActionDispatcher.php:89
PHP  19. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->doDispatch() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:44
PHP  20. Mautic\EmailBundle\EventListener\CampaignSubscriber->onCampaignTriggerActionSendEmailToUser() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:214
PHP  21. Mautic\EmailBundle\Model\SendEmailToUser->sendEmailToUsers() /var/www/html/app/bundles/EmailBundle/EventListener/CampaignSubscriber.php:377
PHP  22. implode() /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php:60

Notice: Array to string conversion in /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php on line 60

Call Stack:
    0.0011     401352   1. {main}() /var/www/html/bin/console:0
    0.0613    1240848   2. Symfony\Bundle\FrameworkBundle\Console\Application->run() /var/www/html/bin/console:43
    0.0697    1400264   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/console/Application.php:148
    0.5348    9746328   4. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:74
    0.5350    9746944   5. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/console/Application.php:255
    0.5350    9746944   6. Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:86
    0.5366    9755744   7. Mautic\CampaignBundle\Command\TriggerCampaignCommand->run() /var/www/html/vendor/symfony/console/Application.php:1005
    0.5370    9757464   8. Mautic\CampaignBundle\Command\TriggerCampaignCommand->execute() /var/www/html/vendor/symfony/console/Command/Command.php:255
    0.5751   10515776   9. Mautic\CampaignBundle\Command\TriggerCampaignCommand->triggerCampaign() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:277
    0.5756   10517152  10. Mautic\CampaignBundle\Command\TriggerCampaignCommand->executeKickoff() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:328
    0.5758   10517152  11. Mautic\CampaignBundle\Executioner\KickoffExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Command/TriggerCampaignCommand.php:372
    0.5936   10790328  12. Mautic\CampaignBundle\Executioner\KickoffExecutioner->executeOrScheduleEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:122
    0.6306   11249224  13. Mautic\CampaignBundle\Executioner\EventExecutioner->executeEventsForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/KickoffExecutioner.php:222
    0.6314   11251472  14. Mautic\CampaignBundle\Executioner\EventExecutioner->executeForContacts() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:245
    0.8167   13045208  15. Mautic\CampaignBundle\Executioner\EventExecutioner->executeLogs() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:172
    0.8168   13045208  16. Mautic\CampaignBundle\Executioner\Event\ActionExecutioner->execute() /var/www/html/app/bundles/CampaignBundle/Executioner/EventExecutioner.php:201
    0.8168   13045232  17. Mautic\CampaignBundle\Executioner\Dispatcher\ActionDispatcher->dispatchEvent() /var/www/html/app/bundles/CampaignBundle/Executioner/Event/ActionExecutioner.php:67
    0.8180   13050496  18. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() /var/www/html/app/bundles/CampaignBundle/Executioner/Dispatcher/ActionDispatcher.php:89
    0.8180   13050256  19. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->doDispatch() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:44
    0.8180   13050256  20. Mautic\EmailBundle\EventListener\CampaignSubscriber->onCampaignTriggerActionSendEmailToUser() /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php:214
    0.8181   13050872  21. Mautic\EmailBundle\Model\SendEmailToUser->sendEmailToUsers() /var/www/html/app/bundles/EmailBundle/EventListener/CampaignSubscriber.php:377
    1.4253   14446608  22. implode() /var/www/html/app/bundles/EmailBundle/Model/SendEmailToUser.php:60

 1/1 [============================] 100%
1 total event was executed
0 total events were scheduled

Triggering scheduled events
0 total events(s) to be processed in batches of 100 contacts

0 total events were executed
0 total events were scheduled

Triggering events for inactive contacts

0 total events were executed
0 total events were scheduled

@hluchas
Copy link
Contributor Author

hluchas commented May 13, 2020

Reproduced with this action configuration
Snímek obrazovky 2020-05-13 v 13 38 38

Working on this

@hluchas
Copy link
Contributor Author

hluchas commented May 13, 2020

@dennisameling fixed in 3bca017

Copy link
Member

@dennisameling dennisameling left a comment

Choose a reason for hiding this comment

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

CLI command works without issues now. Thanks @hluchas 🎉

@alanhartless alanhartless merged commit f4fc596 into mautic:3.x May 15, 2020
@escopecz escopecz moved this from Needs code review and/or test to Done in Mautic 3 May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs ready-to-test PR's that are ready to test
Projects
No open projects
Mautic 3
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants