Unverified Commit 17ae1d53 authored by Jonathan Hedstrom's avatar Jonathan Hedstrom
Browse files

Issue #2865177 by jhedstrom: Pass the digest notifier along to the mail system

parent 3221e3f8
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -129,14 +129,17 @@ class DigestManager implements DigestManagerInterface {
   *   The entity type. Leave empty for global digests.
   * @param string|int $entity_id
   *   The entity ID. Leave empty for global digests.
   * @param \Drupal\message_digest\Plugin\Notifier\DigestInterface $notifier
   *   The digest notifier plugin ID used for this digest.
   * @param string $formatted_message
   *   The formatted message.
   */
  protected function deliverDigest(UserInterface $account, $entity_type, $entity_id, $formatted_message) {
  protected function deliverDigest(UserInterface $account, $entity_type, $entity_id, DigestInterface $notifier, $formatted_message) {
    $params = [
      'body' => $formatted_message,
      'entity_type' => $entity_type,
      'entity_id' => $entity_id,
      'notifier' => $notifier,
    ];
    // @todo Use the message_notify sender service.
    // @see https://www.drupal.org/node/2103013
@@ -210,7 +213,7 @@ class DigestManager implements DigestManagerInterface {
    $this->moduleHandler->alter('message_digest_view_mode', $context, $notifier, $account);
    if ($context['deliver']) {
      $formatted_messages = $this->formatter->format($context['messages'], $context['view_modes'], $account);
      $this->deliverDigest($account, $context['entity_type'], $context['entity_id'], $formatted_messages);
      $this->deliverDigest($account, $context['entity_type'], $context['entity_id'], $notifier, $formatted_messages);
    }
  }