mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Do not send notifications to archived/deleted users
This commit is contained in:
parent
7174939fe0
commit
912d0aebc5
@ -64,7 +64,7 @@ class InvoiceCreatedNotification implements ShouldQueue
|
|||||||
/* Returns an array of notification methods */
|
/* Returns an array of notification methods */
|
||||||
$methods = $this->findUserNotificationTypes($invoice->invitations()->first(), $company_user, 'invoice', ['all_notifications', 'invoice_created', 'invoice_created_all']);
|
$methods = $this->findUserNotificationTypes($invoice->invitations()->first(), $company_user, 'invoice', ['all_notifications', 'invoice_created', 'invoice_created_all']);
|
||||||
/* If one of the methods is email then we fire the EntitySentMailer */
|
/* If one of the methods is email then we fire the EntitySentMailer */
|
||||||
// if (($key = array_search('mail', $methods))) {
|
|
||||||
if (($key = array_search('mail', $methods)) !== false) {
|
if (($key = array_search('mail', $methods)) !== false) {
|
||||||
unset($methods[$key]);
|
unset($methods[$key]);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ trait UserNotifies
|
|||||||
$notifiable_methods = [];
|
$notifiable_methods = [];
|
||||||
$notifications = $company_user->notifications;
|
$notifications = $company_user->notifications;
|
||||||
|
|
||||||
if ($company_user->company->is_disabled && is_array($notifications->email)) {
|
if ($company_user->company->is_disabled && is_array($notifications->email) || $company_user->trashed() || $company_user->user->trashed()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ trait UserNotifies
|
|||||||
$notifiable_methods = [];
|
$notifiable_methods = [];
|
||||||
$notifications = $company_user->notifications;
|
$notifications = $company_user->notifications;
|
||||||
|
|
||||||
if ($company_user->company->is_disabled || ! $notifications) {
|
if ($company_user->company->is_disabled || ! $notifications || $company_user->trashed() || $company_user->user->trashed()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ trait UserNotifies
|
|||||||
public function findCompanyUserNotificationType($company_user, $required_permissions) :array
|
public function findCompanyUserNotificationType($company_user, $required_permissions) :array
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($company_user->company->is_disabled) {
|
if ($company_user->company->is_disabled || $company_user->trashed() || $company_user->user->trashed()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user