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:
@@ -41,11 +41,24 @@ class SendEventPackageGalleryExpired implements ShouldQueue
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'gallery_expired', $context, ['event_package_id'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'gallery_expired',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $preferences->shouldNotify($tenant, 'gallery_expired')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'gallery_expired',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -65,14 +78,12 @@ class SendEventPackageGalleryExpired implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'gallery_expired',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -44,11 +44,24 @@ class SendEventPackageGalleryWarning implements ShouldQueue
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'gallery_warning', $context, ['event_package_id', 'days_remaining'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'gallery_warning',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $preferences->shouldNotify($tenant, 'gallery_warnings')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'gallery_warning',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -69,14 +82,12 @@ class SendEventPackageGalleryWarning implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'gallery_warning',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -43,12 +43,24 @@ class SendEventPackageGuestLimitNotification implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'guest_limit', $context, ['event_package_id', 'limit'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'guest_limits')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -68,14 +80,12 @@ class SendEventPackageGuestLimitNotification implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -45,12 +45,24 @@ class SendEventPackageGuestThresholdWarning implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'guest_threshold', $context, ['event_package_id', 'threshold', 'limit'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'guest_thresholds')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -71,14 +83,12 @@ class SendEventPackageGuestThresholdWarning implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'guest_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -43,12 +43,24 @@ class SendEventPackagePhotoLimitNotification implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'photo_limit', $context, ['event_package_id', 'limit'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'photo_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'photo_limits')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'photo_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -69,14 +81,12 @@ class SendEventPackagePhotoLimitNotification implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'photo_limit',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -45,12 +45,24 @@ class SendEventPackagePhotoThresholdWarning implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'photo_threshold', $context, ['event_package_id', 'threshold', 'limit'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'photo_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'photo_thresholds')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'photo_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($eventPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -71,14 +83,12 @@ class SendEventPackagePhotoThresholdWarning implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'photo_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($this->context($eventPackage), ['reason' => 'no_recipient']),
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $this->context($eventPackage);
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -42,12 +42,24 @@ class SendTenantPackageEventThresholdWarning implements ShouldQueue
|
||||
|
||||
$tenant = $tenantPackage->tenant;
|
||||
|
||||
$context = $this->context($tenantPackage);
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'event_threshold', $context, ['tenant_package_id', 'threshold', 'limit'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'event_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'event_thresholds')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'event_threshold',
|
||||
'status' => 'skipped',
|
||||
'context' => $this->context($tenantPackage),
|
||||
'context' => $context,
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -68,14 +80,12 @@ class SendTenantPackageEventThresholdWarning implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'event_threshold',
|
||||
'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,
|
||||
|
||||
@@ -37,15 +37,26 @@ class SendTenantPackageExpiredNotification implements ShouldQueue
|
||||
|
||||
$tenant = $tenantPackage->tenant;
|
||||
|
||||
$context = [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
];
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'package_expired', $context, ['tenant_package_id'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'package_expired',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'package_expired')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'package_expired',
|
||||
'status' => 'skipped',
|
||||
'context' => [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
'reason' => 'opt_out',
|
||||
],
|
||||
'context' => array_merge($context, ['reason' => 'opt_out']),
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -65,19 +76,12 @@ class SendTenantPackageExpiredNotification implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'package_expired',
|
||||
'status' => 'skipped',
|
||||
'context' => [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
'reason' => 'no_recipient',
|
||||
],
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
];
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
@@ -40,16 +40,27 @@ class SendTenantPackageExpiringNotification implements ShouldQueue
|
||||
|
||||
$tenant = $tenantPackage->tenant;
|
||||
|
||||
$context = [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
'days_remaining' => $this->daysRemaining,
|
||||
];
|
||||
|
||||
if ($this->isDuplicateNotification($tenant, 'package_expiring', $context, ['tenant_package_id', 'days_remaining'])) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'package_expiring',
|
||||
'status' => 'skipped',
|
||||
'context' => array_merge($context, ['reason' => 'duplicate']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$preferences = app(\App\Services\Packages\TenantNotificationPreferences::class);
|
||||
if (! $preferences->shouldNotify($tenant, 'package_expiring')) {
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'package_expiring',
|
||||
'status' => 'skipped',
|
||||
'context' => [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
'days_remaining' => $this->daysRemaining,
|
||||
'reason' => 'opt_out',
|
||||
],
|
||||
'context' => array_merge($context, ['reason' => 'opt_out']),
|
||||
]);
|
||||
|
||||
return;
|
||||
@@ -70,21 +81,12 @@ class SendTenantPackageExpiringNotification implements ShouldQueue
|
||||
$this->logNotification($tenant, [
|
||||
'type' => 'package_expiring',
|
||||
'status' => 'skipped',
|
||||
'context' => [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
'days_remaining' => $this->daysRemaining,
|
||||
'reason' => 'no_recipient',
|
||||
],
|
||||
'context' => array_merge($context, ['reason' => 'no_recipient']),
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$context = [
|
||||
'tenant_package_id' => $tenantPackage->id,
|
||||
'days_remaining' => $this->daysRemaining,
|
||||
];
|
||||
|
||||
$this->dispatchToRecipients(
|
||||
$tenant,
|
||||
$emails,
|
||||
|
||||
Reference in New Issue
Block a user