Merge pull request #12422 from marcusmoore/fix/adhere-to-email-alerts-setting

Have acceptance result notifications adhere to alerts enabled setting
This commit is contained in:
snipe 2023-02-15 18:46:08 -08:00 committed by GitHub
commit e9ab90eafc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View file

@ -16,12 +16,16 @@ class CheckoutAcceptance extends Model
'declined_at' => 'datetime',
];
// Get the mail recipient from the config
public function routeNotificationForMail(): string
/**
* Get the mail recipient from the config
*
* @return mixed|string|null
*/
public function routeNotificationForMail()
{
// At this point the endpoint is the same for everything.
// In the future this may want to be adapted for individual notifications.
return (config('mail.reply_to.address')) ? config('mail.reply_to.address') : '' ;
return Setting::getSettings()->alert_email;
}
/**

View file

@ -46,6 +46,11 @@ class AcceptanceAssetAcceptedNotification extends Notification
}
public function shouldSend($notifiable, $channel)
{
return $this->settings->alerts_enabled && ! empty($this->settings->alert_email);
}
/**
* Get the mail representation of the notification.
*

View file

@ -44,6 +44,11 @@ class AcceptanceAssetDeclinedNotification extends Notification
}
public function shouldSend($notifiable, $channel)
{
return $this->settings->alerts_enabled && ! empty($this->settings->alert_email);
}
/**
* Get the mail representation of the notification.
*