Skip to content

Commit

Permalink
Fix multiple notification recipients
Browse files Browse the repository at this point in the history
PR laravel#24606 unfortunately broke on-demand notifications addressed to multiple recipients.
This fixes Issue  laravel#24729 and laravel#24956
  • Loading branch information
Karlis Paegle authored and Karlis Paegle committed Jul 24, 2018
1 parent c8682e1 commit e7e0e11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Notifications/Channels/MailChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected function getRecipients($notifiable, $notification, $message)

return collect($recipients)->mapWithKeys(function ($recipient, $email) {
return is_numeric($email)
? [(is_string($recipient) ? $recipient : $recipient->email)]
? [$email => (is_string($recipient) ? $recipient : $recipient->email)]
: [$email => $recipient];
})->all();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function test_mail_is_sent_to_named_address()
Mockery::on(function ($closure) {
$message = Mockery::mock(\Illuminate\Mail\Message::class);

$message->shouldReceive('to')->once()->with(['taylor@laravel.com' => 'Taylor Otwell', 'foo_taylor@laravel.com']);
$message->shouldReceive('to')->once()->with(['taylor@laravel.com' => 'Taylor Otwell', 'foo_taylor@laravel.com', 'bar_taylor@laravel.com']);

$message->shouldReceive('cc')->once()->with('cc@deepblue.com', 'cc');

Expand Down Expand Up @@ -201,6 +201,7 @@ public function routeNotificationForMail($notification)
return [
$this->email => $this->name,
'foo_'.$this->email,
'bar_'.$this->email,
];
}
}
Expand Down

0 comments on commit e7e0e11

Please sign in to comment.