Add notification filters

This commit is contained in:
2026-04-24 20:02:22 +00:00
parent 5f74ddd964
commit c54df44ebe
24 changed files with 1288 additions and 7 deletions
@@ -9,14 +9,22 @@ use App\Models\NotificationDeliveryLog;
class QueueTicketStatusChangedNotificationDeliveries
{
public function __construct(
private readonly MatchNotificationFilters $matchNotificationFilters,
) {}
public function handle(TicketStatusChanged|TicketCreated $event): void
{
NotificationAction::query()
->enabled()
->where('project_id', $event->payload->projectId)
->where('event_type', $event->payload->eventType->value)
->get(['channel', 'id'])
->get(['channel', 'filters', 'id'])
->each(function (NotificationAction $notificationAction) use ($event): void {
if (! $this->matchNotificationFilters->handle($notificationAction->filters ?? [], $event->payload)) {
return;
}
$notificationDeliveryLogId = null;
if (in_array($notificationAction->channel, [NotificationChannel::Discord, NotificationChannel::Webhook], true)) {