Fix broken opt-in notifications

This commit is contained in:
2022-02-11 00:51:16 +00:00
parent 025f69f622
commit 294c678283
157 changed files with 39 additions and 18 deletions

View File

@@ -52,10 +52,9 @@ class ApplicationApproved extends Notification implements ShouldQueue
*
* @return void
*/
public function __construct(User $user, Application $application)
public function __construct(Application $application)
{
$this->application = $application;
$this->user = $user;
}
public function channels()
@@ -65,7 +64,7 @@ class ApplicationApproved extends Notification implements ShouldQueue
public function optOut($notifiable)
{
return Options::getOption('notify_applicant_approved') !== 1;
return Options::getOption('notify_applicant_approved') != 1;
}
/**
@@ -79,12 +78,10 @@ class ApplicationApproved extends Notification implements ShouldQueue
return (new MailMessage)
->greeting('Hi ' . $notifiable->name . ',')
->from(config('notification.sender.address'), config('notification.sender.name'))
->subject(config('app.name').' - '.$this->application->response->vacancy->vacancyName.' application approved')
->line('<br />')
->subject(config('app.name').' - application approved')
->line('Congratulations! Your most recent application has been approved by the reviewing team.')
->line('You have just received the Reviewer role, which allows you to view and vote on other applications.')
->line('You should have received more information about your onboarding process by now.')
->line('<br />')
->line('Good luck and welcome aboard!')
->action('Sign in', url(route('login')))
->salutation('The team at ' . config('app.name'));

0
app/Notifications/ApplicationConfirmed.php Normal file → Executable file
View File

View File

@@ -27,6 +27,7 @@ use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Log;
class ApplicationMoved extends Notification implements ShouldQueue
{
@@ -42,9 +43,21 @@ class ApplicationMoved extends Notification implements ShouldQueue
//
}
public function channels()
{
Log::debug('Application moved notification: channels chosen', [
'channels' => $this->chooseChannelsViaOptions()
]);
return $this->chooseChannelsViaOptions();
}
public function optOut($notifiable)
{
return Options::getOption('notify_application_status_change') !== 1;
Log::debug('Application moved notification: opt out verified', [
'opt-out' => Options::getOption('notify_application_status_change') != 1
]);
return Options::getOption('notify_application_status_change') != 1;
}
/**

0
app/Notifications/AppointmentCancelled.php Normal file → Executable file
View File

View File

@@ -21,6 +21,7 @@
namespace App\Notifications;
use App\Appointment;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@@ -30,14 +31,17 @@ class AppointmentFinished extends Notification implements ShouldQueue
{
use Queueable;
public $appointment;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
public function __construct(Appointment $appointment)
{
//
$this->appointment = $appointment;
}
/**
@@ -63,7 +67,7 @@ class AppointmentFinished extends Notification implements ShouldQueue
->greeting("Hi " . $notifiable->name . ",")
->from(config('notification.sender.address'), config('notification.sender.name'))
->subject(config('app.name').' - appointment completed')
->line('Your appointment has been marked as completed!')
->line('Your appointment, "' . $this->appointment->appointmentDescription . '", has been marked as completed!')
->line('Please allow an additional day for your application to be fully processed.')
->action('View applications', url(route('showUserApps')))
->salutation('The team at ' . config('app.name'));

View File

@@ -61,7 +61,7 @@ class NewApplicant extends Notification implements ShouldQueue
public function optOut($notifiable)
{
return Options::getOption('notify_new_user') !== 1;
return Options::getOption('notify_new_user') != 1;
}
/**

View File

@@ -48,7 +48,7 @@ class NewComment extends Notification implements ShouldQueue
public function optOut($notifiable)
{
return Options::getOption('notify_application_comment') !== 1;
return Options::getOption('notify_application_comment') != 1;
}
/**

View File

@@ -54,7 +54,7 @@ class NewUser extends Notification implements ShouldQueue
public function optOut($notifiable)
{
return Options::getOption('notify_new_user') !== 1;
return Options::getOption('notify_new_user') != 1;
}
/**

View File

@@ -48,7 +48,7 @@ class VacancyClosed extends Notification implements ShouldQueue
public function optOut($notifiable)
{
return Options::getOption('notify_vacancystatus_change') !== 1;
return Options::getOption('notify_vacancystatus_change') != 1;
}
/**