Fix Meet programme sync when linking an existing room.
Deploy Ladill Events / deploy (push) Successful in 37s
Deploy Ladill Events / deploy (push) Successful in 37s
PATCH the pre-linked room by UUID so programme_snapshot lands on the room users join instead of creating a duplicate. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,6 +26,10 @@ class ServiceMeetLinkTest extends TestCase
|
||||
'room' => ['uuid' => 'room-uuid-123'],
|
||||
'join_url' => 'https://meet.ladill.com/r/room-uuid-123',
|
||||
], 201),
|
||||
config('meet.url').'/rooms/*' => Http::response([
|
||||
'room' => ['uuid' => 'room-uuid-123'],
|
||||
'join_url' => 'https://meet.ladill.com/r/room-uuid-123',
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$this->owner = User::factory()->create(['public_id' => 'usr_meet_link']);
|
||||
@@ -87,4 +91,71 @@ class ServiceMeetLinkTest extends TestCase
|
||||
$sessions = $event->fresh()->content()['virtual_sessions'];
|
||||
$this->assertSame('room-uuid-123', $sessions[0]['meet_room_uuid'] ?? null);
|
||||
}
|
||||
|
||||
public function test_link_room_patches_existing_meet_room_with_programme_snapshot(): void
|
||||
{
|
||||
$programme = QrCode::create([
|
||||
'user_id' => $this->owner->id,
|
||||
'short_code' => 'prog-link-1',
|
||||
'type' => QrCode::TYPE_ITINERARY,
|
||||
'label' => 'Summit programme',
|
||||
'payload' => [
|
||||
'content' => [
|
||||
'title' => 'Summit programme',
|
||||
'days' => [
|
||||
[
|
||||
'label' => 'Day 1',
|
||||
'items' => [
|
||||
['ref' => 'item-1', 'time' => '09:00', 'title' => 'Opening keynote', 'host' => 'Alex'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'style' => [],
|
||||
],
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$event = QrCode::create([
|
||||
'user_id' => $this->owner->id,
|
||||
'short_code' => 'evt-prog-link',
|
||||
'type' => QrCode::TYPE_EVENT,
|
||||
'label' => 'Summit',
|
||||
'payload' => [
|
||||
'content' => [
|
||||
'title' => 'Summit',
|
||||
'format' => 'virtual',
|
||||
'programme_qr_id' => $programme->id,
|
||||
'virtual_sessions' => [],
|
||||
],
|
||||
'style' => [],
|
||||
],
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
Http::fake([
|
||||
config('meet.url').'/rooms/existing-room-uuid' => Http::response([
|
||||
'room' => ['uuid' => 'existing-room-uuid'],
|
||||
'join_url' => 'https://meet.ladill.com/r/existing-room-uuid',
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$this->withToken('test-meet-key')
|
||||
->postJson('/api/service/v1/events/'.$event->id.'/link-room', [
|
||||
'owner_ref' => $this->owner->public_id,
|
||||
'meet_room_uuid' => 'existing-room-uuid',
|
||||
'meet_room_type' => 'town_hall',
|
||||
'join_url' => 'https://meet.ladill.com/r/existing-room-uuid',
|
||||
'title' => 'Opening keynote',
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('event.meet_room_uuid', 'existing-room-uuid');
|
||||
|
||||
Http::assertSent(function ($request) {
|
||||
return $request->method() === 'PATCH'
|
||||
&& str_ends_with($request->url(), '/rooms/existing-room-uuid')
|
||||
&& ($request['settings']['programme_snapshot']['title'] ?? '') === 'Summit programme'
|
||||
&& ($request['settings']['programme_snapshot']['days'][0]['items'][0]['title'] ?? '') === 'Opening keynote';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user