fixed notification system and added a new tenant notifications receipt table to track read status and filter messages by scope.
This commit is contained in:
@@ -40,12 +40,24 @@ class SendTenantPackageEventLimitNotification implements ShouldQueue
|
||||
|
||||
$tenant = $tenantPackage->tenant;
|
||||
|
||||
$context = $this->context($tenantPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'event_limit', $context, ['tenant_package_id', 'limit'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'event_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'event_limits')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'event_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($tenantPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -65,14 +77,12 @@ class SendTenantPackageEventLimitNotification implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'event_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($tenantPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($tenantPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
Reference in New Issue
Block a user