fix gitlab tests
This commit is contained in:
@@ -14,7 +14,6 @@ class WhatsappInviteNotificationService
|
||||
$listenerCount = Event::hasListeners(WhatsappInvitesSend::class) ? 1 : 0;
|
||||
if ($listenerCount === 0) {
|
||||
Log::warning('WhatsappInvitesSend has no listeners registered.');
|
||||
|
||||
return [
|
||||
'ok' => false,
|
||||
'message' => 'No event listener registered for WhatsappInvitesSend.',
|
||||
@@ -30,7 +29,6 @@ class WhatsappInviteNotificationService
|
||||
$out[$e] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return array_keys($out);
|
||||
};
|
||||
|
||||
@@ -49,9 +47,9 @@ class WhatsappInviteNotificationService
|
||||
$to = $primaryEmails;
|
||||
$cc = [];
|
||||
|
||||
if (! empty($primaryEmails) && ! empty($secondaryEmails)) {
|
||||
if (!empty($primaryEmails) && !empty($secondaryEmails)) {
|
||||
$cc = array_values(array_diff($secondaryEmails, $primaryEmails));
|
||||
} elseif (empty($primaryEmails) && ! empty($secondaryEmails)) {
|
||||
} elseif (empty($primaryEmails) && !empty($secondaryEmails)) {
|
||||
$to = $secondaryEmails;
|
||||
}
|
||||
|
||||
@@ -59,7 +57,6 @@ class WhatsappInviteNotificationService
|
||||
Log::warning('Skipping WhatsApp invite: no recipient email(s).', [
|
||||
'parent_id' => $bundle['parent']['id'] ?? null,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -76,7 +73,7 @@ class WhatsappInviteNotificationService
|
||||
|
||||
$triggered++;
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('WhatsappInvitesSend dispatch failed: '.$e->getMessage());
|
||||
Log::error('WhatsappInvitesSend dispatch failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,12 +87,12 @@ class WhatsappInviteNotificationService
|
||||
{
|
||||
$collected = [];
|
||||
|
||||
if (! empty($bundle['emails_secondary'])) {
|
||||
if (!empty($bundle['emails_secondary'])) {
|
||||
$collected = array_merge($collected, (array) $bundle['emails_secondary']);
|
||||
}
|
||||
if (! empty($bundle['secondary_parents'])) {
|
||||
if (!empty($bundle['secondary_parents'])) {
|
||||
foreach ((array) $bundle['secondary_parents'] as $sp) {
|
||||
if (! empty($sp['email'])) {
|
||||
if (!empty($sp['email'])) {
|
||||
$collected[] = $sp['email'];
|
||||
}
|
||||
}
|
||||
@@ -103,11 +100,11 @@ class WhatsappInviteNotificationService
|
||||
|
||||
$parent = $bundle['parent'] ?? [];
|
||||
foreach (['secondary_email', 'secondparent_email', 'sec_email', 'email_secondary'] as $key) {
|
||||
if (! empty($parent[$key])) {
|
||||
if (!empty($parent[$key])) {
|
||||
$collected[] = $parent[$key];
|
||||
}
|
||||
}
|
||||
if (! empty($parent['secondparent']['email'])) {
|
||||
if (!empty($parent['secondparent']['email'])) {
|
||||
$collected[] = $parent['secondparent']['email'];
|
||||
}
|
||||
|
||||
@@ -119,12 +116,12 @@ class WhatsappInviteNotificationService
|
||||
->where('firstparent_id', $primaryId)
|
||||
->orderByDesc('updated_at')
|
||||
->first();
|
||||
if (! empty($row?->secondparent_email)) {
|
||||
if (!empty($row?->secondparent_email)) {
|
||||
$collected[] = $row->secondparent_email;
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('Secondary email DB lookup failed: '.$e->getMessage());
|
||||
Log::warning('Secondary email DB lookup failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
return $normalize($collected);
|
||||
|
||||
Reference in New Issue
Block a user