refactor(notifications): standardize getRecipients method signatures
This commit is contained in:
@@ -163,14 +163,17 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
|
||||
];
|
||||
}
|
||||
|
||||
public function getRecipients($notification)
|
||||
public function getRecipients(): array
|
||||
{
|
||||
$recipients = data_get($notification, 'emails', null);
|
||||
if (is_null($recipients)) {
|
||||
return $this->members()->pluck('email')->toArray();
|
||||
$recipients = $this->members()->pluck('email')->toArray();
|
||||
$validatedEmails = array_filter($recipients, function ($email) {
|
||||
return filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||
});
|
||||
if (is_null($validatedEmails)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return explode(',', $recipients);
|
||||
return array_values($validatedEmails);
|
||||
}
|
||||
|
||||
public function isAnyNotificationEnabled()
|
||||
|
||||
Reference in New Issue
Block a user