Skip to content

Commit

Permalink
Merge branch 'next-22891/fix-newsletter-route-does-not-handle-double-…
Browse files Browse the repository at this point in the history
…optin-setting-correctly' into '6.4.18.1'

NEXT-22891 - Fix newsletter route does not handle double optin setting correctly

See merge request shopware/6/product/platform!8819
  • Loading branch information
pweyck committed Jan 3, 2023
2 parents 6d9c814 + f08c62f commit be03ef9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 73 deletions.
6 changes: 3 additions & 3 deletions Content/Newsletter/SalesChannel/NewsletterSubscribeRoute.php
Expand Up @@ -175,7 +175,7 @@ public function subscribe(RequestDataBag $dataBag, SalesChannelContext $context,

$recipient = $this->getNewsletterRecipient('email', $data['email'], $context->getContext());

if ($data['status'] === self::STATUS_DIRECT) {
if (!$this->systemConfigService->getBool('core.newsletter.doubleOptIn')) {
$event = new NewsletterConfirmEvent($context->getContext(), $recipient, $context->getSalesChannel()->getId());
$this->eventDispatcher->dispatch($event);

Expand Down Expand Up @@ -262,8 +262,8 @@ private function getNewsletterRecipientId(string $email, SalesChannelContext $co
private function getOptionSelection(): array
{
return [
self::OPTION_DIRECT => self::STATUS_DIRECT,
self::OPTION_SUBSCRIBE => self::STATUS_NOT_SET,
self::OPTION_DIRECT => $this->systemConfigService->getBool('core.newsletter.doubleOptIn') ? self::STATUS_NOT_SET : self::STATUS_DIRECT,
self::OPTION_SUBSCRIBE => $this->systemConfigService->getBool('core.newsletter.doubleOptIn') ? self::STATUS_NOT_SET : self::STATUS_DIRECT,
self::OPTION_CONFIRM_SUBSCRIBE => self::STATUS_OPT_IN,
self::OPTION_UNSUBSCRIBE => self::STATUS_OPT_OUT,
];
Expand Down

This file was deleted.

0 comments on commit be03ef9

Please sign in to comment.