Fix Events mail calendar sync when virtual sessions lack ids.
Deploy Ladill Events / deploy (push) Successful in 52s

Generate session ids before upserting and fall back to the main event date so August events reach Mail calendar.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-04 12:27:48 +00:00
co-authored by Cursor
parent d25682bc6c
commit a00f032b5b
3 changed files with 38 additions and 3 deletions
@@ -84,6 +84,33 @@ class EventMailCalendarSyncTest extends TestCase
)->count());
}
public function test_virtual_session_without_id_still_syncs_to_mail_calendar(): void
{
$owner = User::factory()->create(['public_id' => 'usr-cal-4', 'email' => 'host@example.com']);
$event = $this->makeEvent($owner, [
'format' => 'virtual',
'name' => 'NextGen Summit 2026',
'starts_at' => '2026-08-26',
'ends_at' => '2026-08-27',
'virtual_sessions' => [[
'id' => null,
'title' => 'NextGen Summit',
'scheduled_at' => '2026-08-26',
'duration_minutes' => 180,
]],
]);
app(EventMailCalendarSyncService::class)->sync($event, $owner);
Http::assertSent(function ($request) use ($event) {
return str_contains($request->url(), '/calendar/events')
&& str_starts_with((string) $request['external_ref'], 'events:'.$event->id.':session:vs-')
&& $request['title'] === 'NextGen Summit';
});
$this->assertNotEmpty(data_get($event->fresh()->payload, 'calendar_sync.items'));
}
public function test_uses_linked_mailbox_when_available(): void
{
Http::fake([