Return programme snapshot from Events link-room API.
Deploy Ladill Events / deploy (push) Successful in 31s
Deploy Ladill Events / deploy (push) Successful in 31s
Meet can persist the agenda locally when linking, even if the service-to-service Meet sync fails. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -110,11 +110,14 @@ class EventMeetRoomLinkService
|
||||
|
||||
$event = $this->sync->sync($event->fresh(), $owner);
|
||||
|
||||
$linkedSession = collect($event->content()['virtual_sessions'] ?? [])
|
||||
->first(fn ($session) => is_array($session) && (string) ($session['id'] ?? '') === $sessionId);
|
||||
|
||||
return array_merge($this->summarizeEvent($event), [
|
||||
'entity_id' => $sessionId,
|
||||
'meet_room_uuid' => $roomUuid,
|
||||
'join_url' => $joinUrl,
|
||||
]);
|
||||
], $this->sync->programmePayloadForSession($event, is_array($linkedSession) ? $linkedSession : $sessions[$matchedIndex]));
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
|
||||
@@ -137,6 +137,21 @@ class EventMeetSyncService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $session
|
||||
* @return array{programme_snapshot: array<string, mixed>|null, linked_programme_items: list<array<string, mixed>>}
|
||||
*/
|
||||
public function programmePayloadForSession(QrCode $event, array $session): array
|
||||
{
|
||||
$programmeSnapshot = $this->programmeSnapshotFor($event);
|
||||
$itemRefs = (array) ($session['programme_item_refs'] ?? []);
|
||||
|
||||
return [
|
||||
'programme_snapshot' => $programmeSnapshot,
|
||||
'linked_programme_items' => $this->programmes->itemsForRefs($programmeSnapshot, $itemRefs),
|
||||
];
|
||||
}
|
||||
|
||||
/** @return array<string, mixed>|null */
|
||||
private function programmeSnapshotFor(QrCode $event): ?array
|
||||
{
|
||||
|
||||
@@ -149,7 +149,9 @@ class ServiceMeetLinkTest extends TestCase
|
||||
'title' => 'Opening keynote',
|
||||
])
|
||||
->assertOk()
|
||||
->assertJsonPath('event.meet_room_uuid', 'existing-room-uuid');
|
||||
->assertJsonPath('event.meet_room_uuid', 'existing-room-uuid')
|
||||
->assertJsonPath('event.programme_snapshot.title', 'Summit programme')
|
||||
->assertJsonPath('event.programme_snapshot.days.0.items.0.title', 'Opening keynote');
|
||||
|
||||
Http::assertSent(function ($request) {
|
||||
return $request->method() === 'PATCH'
|
||||
|
||||
Reference in New Issue
Block a user