[Notifier] Disable notifications on failed messages by default

This commit is contained in:
Fabien Potencier 2019-10-24 22:33:05 +02:00
parent cf49a268b5
commit 4dd82d049b
3 changed files with 6 additions and 4 deletions

View File

@ -1516,6 +1516,7 @@ class Configuration implements ConfigurationInterface
->prototype('scalar')->end()
->end()
->end()
->booleanNode('notification_on_failed_messages')->defaultFalse()->end()
->children()
->arrayNode('channel_policy')
->useAttributeAsKey('name')

View File

@ -1934,9 +1934,11 @@ class FrameworkExtension extends Extension
$container->removeDefinition('notifier.channel.email');
}
if (!$this->messengerConfigEnabled) {
$container->removeDefinition('notifier.failed_message_listener');
} else {
if ($this->messengerConfigEnabled) {
if ($config['notification_on_failed_messages']) {
$container->getDefinition('notifier.failed_message_listener')->addTag('kernel.event_subscriber');
}
// as we have a bus, the channels don't need the transports
$container->getDefinition('notifier.channel.chat')->setArgument(0, null);
$container->getDefinition('notifier.channel.email')->setArgument(0, null);

View File

@ -44,7 +44,6 @@
<service id="notifier.failed_message_listener" class="Symfony\Component\Notifier\EventListener\SendFailedMessageToNotifierListener">
<argument type="service" id="notifier" />
<tag name="kernel.event_subscriber" />
</service>
<!-- chatter -->