Commit 013bbb6f authored by Thomas Gauges's avatar Thomas Gauges Committed by Adam Shepherd
Browse files

Issue #3285123 by tgauges: UpdateEmailBuilder requires To-Header to be set...

Issue #3285123 by tgauges: UpdateEmailBuilder requires To-Header to be set while having a weight smaller than ToEmailAdjuster 
parent 48f7a658
Loading
Loading
Loading
Loading
+17 −4
Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UpdateEmailBuilder.php: 17 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -37,10 +37,6 @@ class UpdateEmailBuilder extends EmailBuilderBase {
   * {@inheritdoc}
   */
  public function build(EmailInterface $email) {
    if (empty($email->getTo())) {
      throw new SkipMailException('No update notification address configured.');
    }

    $config = $this->helper()->config();
    $notify_all = ($config->get('update.settings')->get('notification.threshold') == 'all');
    \Drupal::moduleHandler()->loadInclude('update', 'install');
@@ -66,6 +62,23 @@ class UpdateEmailBuilder extends EmailBuilderBase {
    }
  }

  /**
   * Skip sending the update email when no 'To' header is configured.
   *
   * This check has to be done after
   * {@see \Drupal\symfony_mailer\EmailInterface::PHASE_BUILD} because
   * otherwise the 'To' header might not be set yet.
   *
   * @throws \Drupal\symfony_mailer\Exception\SkipMailException
   *
   * @see \Drupal\symfony_mailer\EmailInterface::PHASE_PRE_RENDER
   */
  public function preRender(EmailInterface $email): void {
    if (empty($email->getTo())) {
      throw new SkipMailException('No update notification address configured.');
    }
  }

  /**
   * {@inheritdoc}
   */