Fix broken opt-in notifications
This commit is contained in:
parent
025f69f622
commit
294c678283
0
CODEOWNERS
Normal file → Executable file
0
CODEOWNERS
Normal file → Executable file
0
app/Absence.php
Normal file → Executable file
0
app/Absence.php
Normal file → Executable file
0
app/Console/Commands/Install.php
Normal file → Executable file
0
app/Console/Commands/Install.php
Normal file → Executable file
0
app/Exceptions/ApplicationNotFoundException.php
Normal file → Executable file
0
app/Exceptions/ApplicationNotFoundException.php
Normal file → Executable file
0
app/Exceptions/EmptyFormException.php
Normal file → Executable file
0
app/Exceptions/EmptyFormException.php
Normal file → Executable file
0
app/Exceptions/EmptyOptionsException.php
Normal file → Executable file
0
app/Exceptions/EmptyOptionsException.php
Normal file → Executable file
0
app/Exceptions/FailedCaptchaException.php
Normal file → Executable file
0
app/Exceptions/FailedCaptchaException.php
Normal file → Executable file
0
app/Exceptions/FileUploadException.php
Normal file → Executable file
0
app/Exceptions/FileUploadException.php
Normal file → Executable file
0
app/Exceptions/FormHasConstraintsException.php
Normal file → Executable file
0
app/Exceptions/FormHasConstraintsException.php
Normal file → Executable file
0
app/Exceptions/IncompleteApplicationException.php
Normal file → Executable file
0
app/Exceptions/IncompleteApplicationException.php
Normal file → Executable file
0
app/Exceptions/InvalidAppointmentException.php
Normal file → Executable file
0
app/Exceptions/InvalidAppointmentException.php
Normal file → Executable file
0
app/Exceptions/InvalidAppointmentStatusException.php
Normal file → Executable file
0
app/Exceptions/InvalidAppointmentStatusException.php
Normal file → Executable file
0
app/Exceptions/InvalidGamePreferenceException.php
Normal file → Executable file
0
app/Exceptions/InvalidGamePreferenceException.php
Normal file → Executable file
0
app/Exceptions/InvalidInviteException.php
Normal file → Executable file
0
app/Exceptions/InvalidInviteException.php
Normal file → Executable file
0
app/Exceptions/OptionCategoryNotFoundException.php
Normal file → Executable file
0
app/Exceptions/OptionCategoryNotFoundException.php
Normal file → Executable file
0
app/Exceptions/OptionNotFoundException.php
Normal file → Executable file
0
app/Exceptions/OptionNotFoundException.php
Normal file → Executable file
0
app/Exceptions/ProfileNotFoundException.php
Normal file → Executable file
0
app/Exceptions/ProfileNotFoundException.php
Normal file → Executable file
0
app/Exceptions/PublicTeamInviteException.php
Normal file → Executable file
0
app/Exceptions/PublicTeamInviteException.php
Normal file → Executable file
0
app/Exceptions/UnavailableApplicationException.php
Normal file → Executable file
0
app/Exceptions/UnavailableApplicationException.php
Normal file → Executable file
0
app/Exceptions/UserAlreadyInvitedException.php
Normal file → Executable file
0
app/Exceptions/UserAlreadyInvitedException.php
Normal file → Executable file
0
app/Exceptions/VacancyNotFoundException.php
Normal file → Executable file
0
app/Exceptions/VacancyNotFoundException.php
Normal file → Executable file
0
app/Facades/DigitalStorageHelper.php
Normal file → Executable file
0
app/Facades/DigitalStorageHelper.php
Normal file → Executable file
0
app/Facades/JSON.php
Normal file → Executable file
0
app/Facades/JSON.php
Normal file → Executable file
0
app/Helpers/DigitalStorageHelper.php
Normal file → Executable file
0
app/Helpers/DigitalStorageHelper.php
Normal file → Executable file
0
app/Helpers/JSON.php
Normal file → Executable file
0
app/Helpers/JSON.php
Normal file → Executable file
0
app/Http/Controllers/AbsenceController.php
Normal file → Executable file
0
app/Http/Controllers/AbsenceController.php
Normal file → Executable file
0
app/Http/Controllers/SecuritySettingsController.php
Normal file → Executable file
0
app/Http/Controllers/SecuritySettingsController.php
Normal file → Executable file
0
app/Http/Middleware/APIAuthenticationMiddleware.php
Normal file → Executable file
0
app/Http/Middleware/APIAuthenticationMiddleware.php
Normal file → Executable file
0
app/Http/Middleware/PasswordExpirationMiddleware.php
Normal file → Executable file
0
app/Http/Middleware/PasswordExpirationMiddleware.php
Normal file → Executable file
0
app/Http/Middleware/PasswordExpirationRedirectMiddleware.php
Normal file → Executable file
0
app/Http/Middleware/PasswordExpirationRedirectMiddleware.php
Normal file → Executable file
0
app/Http/Requests/CancelAppointmentRequest.php
Normal file → Executable file
0
app/Http/Requests/CancelAppointmentRequest.php
Normal file → Executable file
0
app/Http/Requests/SaveSecuritySettings.php
Normal file → Executable file
0
app/Http/Requests/SaveSecuritySettings.php
Normal file → Executable file
0
app/Http/Requests/StoreAbsenceRequest.php
Normal file → Executable file
0
app/Http/Requests/StoreAbsenceRequest.php
Normal file → Executable file
0
app/Http/Requests/UpdateAbsenceRequest.php
Normal file → Executable file
0
app/Http/Requests/UpdateAbsenceRequest.php
Normal file → Executable file
0
app/Http/Requests/UploadFileRequest.php
Normal file → Executable file
0
app/Http/Requests/UploadFileRequest.php
Normal file → Executable file
0
app/Http/Resources/ApplicationResource.php
Normal file → Executable file
0
app/Http/Resources/ApplicationResource.php
Normal file → Executable file
0
app/Http/Resources/AppointmentResource.php
Normal file → Executable file
0
app/Http/Resources/AppointmentResource.php
Normal file → Executable file
0
app/Http/Resources/BanResource.php
Normal file → Executable file
0
app/Http/Resources/BanResource.php
Normal file → Executable file
0
app/Http/Resources/FormResource.php
Normal file → Executable file
0
app/Http/Resources/FormResource.php
Normal file → Executable file
0
app/Http/Resources/OptionResource.php
Normal file → Executable file
0
app/Http/Resources/OptionResource.php
Normal file → Executable file
0
app/Http/Resources/ProfileResource.php
Normal file → Executable file
0
app/Http/Resources/ProfileResource.php
Normal file → Executable file
0
app/Http/Resources/ResponseResource.php
Normal file → Executable file
0
app/Http/Resources/ResponseResource.php
Normal file → Executable file
0
app/Http/Resources/TeamFileResource.php
Normal file → Executable file
0
app/Http/Resources/TeamFileResource.php
Normal file → Executable file
0
app/Http/Resources/TeamResource.php
Normal file → Executable file
0
app/Http/Resources/TeamResource.php
Normal file → Executable file
0
app/Http/Resources/UserResource.php
Normal file → Executable file
0
app/Http/Resources/UserResource.php
Normal file → Executable file
0
app/Http/Resources/VacancyResource.php
Normal file → Executable file
0
app/Http/Resources/VacancyResource.php
Normal file → Executable 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
0
app/Notifications/ApplicationConfirmed.php
Normal file → Executable 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
0
app/Notifications/AppointmentCancelled.php
Normal file → Executable 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'));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
0
app/OneoffApplicant.php
Normal file → Executable file
0
app/OneoffApplicant.php
Normal file → Executable file
0
app/Policies/AbsencePolicy.php
Normal file → Executable file
0
app/Policies/AbsencePolicy.php
Normal file → Executable file
0
app/Policies/ApiKeyPolicy.php
Normal file → Executable file
0
app/Policies/ApiKeyPolicy.php
Normal file → Executable file
0
app/Policies/TeamFilePolicy.php
Normal file → Executable file
0
app/Policies/TeamFilePolicy.php
Normal file → Executable file
0
app/Policies/TeamPolicy.php
Normal file → Executable file
0
app/Policies/TeamPolicy.php
Normal file → Executable file
0
app/Providers/DigitalStorageProvider.php
Normal file → Executable file
0
app/Providers/DigitalStorageProvider.php
Normal file → Executable file
0
app/Providers/JSONProvider.php
Normal file → Executable file
0
app/Providers/JSONProvider.php
Normal file → Executable file
0
app/Services/AccountSuspensionService.php
Normal file → Executable file
0
app/Services/AccountSuspensionService.php
Normal file → Executable file
0
app/Services/ApplicationService.php
Normal file → Executable file
0
app/Services/ApplicationService.php
Normal file → Executable file
3
app/Services/AppointmentService.php
Normal file → Executable file
3
app/Services/AppointmentService.php
Normal file → Executable file
@ -9,6 +9,7 @@ use App\Appointment;
|
||||
use App\Exceptions\InvalidAppointmentStatusException;
|
||||
use App\Notifications\ApplicationMoved;
|
||||
use App\Notifications\AppointmentCancelled;
|
||||
use App\Notifications\AppointmentFinished;
|
||||
use App\Notifications\AppointmentScheduled;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@ -104,7 +105,7 @@ class AppointmentService
|
||||
if ($updateApplication)
|
||||
{
|
||||
$application->setStatus('STAGE_PEERAPPROVAL');
|
||||
$application->user->notify(new ApplicationMoved());
|
||||
$application->user->notify(new AppointmentFinished($application->appointment));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
0
app/Services/CommentService.php
Normal file → Executable file
0
app/Services/CommentService.php
Normal file → Executable file
0
app/Services/ConfigurationService.php
Normal file → Executable file
0
app/Services/ConfigurationService.php
Normal file → Executable file
0
app/Services/ContactService.php
Normal file → Executable file
0
app/Services/ContactService.php
Normal file → Executable file
0
app/Services/DemoService.php
Normal file → Executable file
0
app/Services/DemoService.php
Normal file → Executable file
0
app/Services/FormManagementService.php
Normal file → Executable file
0
app/Services/FormManagementService.php
Normal file → Executable file
0
app/Services/MeetingNoteService.php
Normal file → Executable file
0
app/Services/MeetingNoteService.php
Normal file → Executable file
0
app/Services/ProfileService.php
Normal file → Executable file
0
app/Services/ProfileService.php
Normal file → Executable file
0
app/Services/SecuritySettingsService.php
Normal file → Executable file
0
app/Services/SecuritySettingsService.php
Normal file → Executable file
0
app/Services/TeamFileService.php
Normal file → Executable file
0
app/Services/TeamFileService.php
Normal file → Executable file
0
app/Services/TeamService.php
Normal file → Executable file
0
app/Services/TeamService.php
Normal file → Executable file
@ -22,19 +22,24 @@
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Facades\Options;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
trait Cancellable
|
||||
{
|
||||
public function chooseChannelsViaOptions()
|
||||
{
|
||||
$channels = [];
|
||||
|
||||
// FIXME: This is not letting Slack and Email work at the same time
|
||||
if (Options::getOption('enable_slack_notifications') == 1) {
|
||||
array_push($channels, 'slack');
|
||||
} elseif (Options::getOption('enable_email_notifications') == 1) {
|
||||
array_push($channels, 'email');
|
||||
array_push($channels, 'mail');
|
||||
}
|
||||
|
||||
Log::debug('Cancellable: current channels list', [
|
||||
'channels' => $channels
|
||||
]);
|
||||
|
||||
return $channels;
|
||||
}
|
||||
|
||||
|
0
app/View/Components/AccountStatus.php
Normal file → Executable file
0
app/View/Components/AccountStatus.php
Normal file → Executable file
0
app/View/Components/Button.php
Normal file → Executable file
0
app/View/Components/Button.php
Normal file → Executable file
@ -31,7 +31,8 @@
|
||||
"pragmarx/google2fa-laravel": "^1.3",
|
||||
"sentry/sentry-laravel": "2.9.0",
|
||||
"socialiteproviders/discord": "^4.1",
|
||||
"spatie/laravel-permission": "^3.13"
|
||||
"spatie/laravel-permission": "^3.13",
|
||||
"ext-xdebug": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.3",
|
||||
|
0
composer.lock
generated
Normal file → Executable file
0
composer.lock
generated
Normal file → Executable file
0
config/api.php
Normal file → Executable file
0
config/api.php
Normal file → Executable file
0
config/customization.php
Normal file → Executable file
0
config/customization.php
Normal file → Executable file
0
config/demo.php
Normal file → Executable file
0
config/demo.php
Normal file → Executable file
0
config/ignition.php
Normal file → Executable file
0
config/ignition.php
Normal file → Executable file
0
config/sanctum.php
Normal file → Executable file
0
config/sanctum.php
Normal file → Executable file
0
database/factories/AbsenceFactory.php
Normal file → Executable file
0
database/factories/AbsenceFactory.php
Normal file → Executable file
0
database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php
Normal file → Executable file
0
database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php
Normal file → Executable file
0
database/migrations/2021_01_01_201604_oneoff_applicants.php
Normal file → Executable file
0
database/migrations/2021_01_01_201604_oneoff_applicants.php
Normal file → Executable file
0
database/migrations/2021_01_06_011207_add_category_to_options.php
Normal file → Executable file
0
database/migrations/2021_01_06_011207_add_category_to_options.php
Normal file → Executable file
0
database/migrations/2021_01_06_040550_add_password_last_updated_to_users.php
Normal file → Executable file
0
database/migrations/2021_01_06_040550_add_password_last_updated_to_users.php
Normal file → Executable file
0
database/migrations/2021_07_20_094139_change_bans_table.php
Normal file → Executable file
0
database/migrations/2021_07_20_094139_change_bans_table.php
Normal file → Executable file
0
database/migrations/2021_10_26_000036_add_linked_accounts_table.php
Normal file → Executable file
0
database/migrations/2021_10_26_000036_add_linked_accounts_table.php
Normal file → Executable file
0
database/migrations/2022_02_02_060702_create_absences_table.php
Normal file → Executable file
0
database/migrations/2022_02_02_060702_create_absences_table.php
Normal file → Executable file
0
database/seeders/AbsenceSeeder.php
Normal file → Executable file
0
database/seeders/AbsenceSeeder.php
Normal file → Executable file
0
database/seeders/DatabaseSeeder.php
Normal file → Executable file
0
database/seeders/DatabaseSeeder.php
Normal file → Executable file
0
database/seeders/DefaultOptionsSeeder.php
Normal file → Executable file
0
database/seeders/DefaultOptionsSeeder.php
Normal file → Executable file
0
database/seeders/NewPermissions.php
Normal file → Executable file
0
database/seeders/NewPermissions.php
Normal file → Executable file
0
database/seeders/PermissionSeeder.php
Normal file → Executable file
0
database/seeders/PermissionSeeder.php
Normal file → Executable file
0
database/seeders/UserSeeder.php
Normal file → Executable file
0
database/seeders/UserSeeder.php
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user