Auto-join host into live session when going live from green room.
Deploy Ladill Meet / deploy (push) Successful in 2m1s

Green room poll was racing go-live and sending the host to the ended page; carry participant session into the new live session instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-02 06:57:33 +00:00
co-authored by Cursor
parent eadb77dd5b
commit 8162827957
6 changed files with 248 additions and 7 deletions
+115
View File
@@ -787,6 +787,121 @@ class MeetWebTest extends TestCase
$this->assertSame('host', $participant->fresh()->role);
}
public function test_host_go_live_auto_joins_live_session(): void
{
$room = Room::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'host_user_ref' => $this->user->public_id,
'title' => 'NextGen Summit',
'type' => 'town_hall',
'status' => 'live',
'scheduled_at' => now()->addHour(),
'timezone' => 'UTC',
'settings' => array_merge(config('meet.default_settings'), [
'green_room' => true,
'stage_mode' => true,
]),
]);
$greenSession = Session::create([
'owner_ref' => $this->user->public_id,
'room_id' => $room->id,
'media_room_name' => 'meet-'.$room->uuid.'-green',
'status' => 'live',
'session_mode' => 'green_room',
'presenter_refs' => [$this->user->public_id],
'started_at' => now(),
]);
$hostParticipant = \App\Models\Participant::create([
'owner_ref' => $this->user->public_id,
'session_id' => $greenSession->id,
'user_ref' => $this->user->public_id,
'display_name' => $this->user->name,
'role' => 'host',
'status' => 'joined',
'joined_at' => now(),
]);
$this->actingAs($this->user)
->withSession(["meet.participant.{$greenSession->uuid}" => $hostParticipant->uuid])
->postJson(route('meet.room.townhall.live', $greenSession))
->assertOk()
->assertJson(['mode' => 'live']);
$liveSession = Session::query()
->where('room_id', $room->id)
->where('session_mode', 'live')
->first();
$this->assertNotNull($liveSession);
$this->assertSame('ended', $greenSession->fresh()->status);
$this->actingAs($this->user)
->get(route('meet.room', $liveSession))
->assertOk();
$this->assertDatabaseHas('meet_participants', [
'session_id' => $liveSession->id,
'user_ref' => $this->user->public_id,
'role' => 'host',
'status' => 'joined',
]);
}
public function test_green_room_poll_redirects_presenters_to_live_session(): void
{
$room = Room::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'host_user_ref' => $this->user->public_id,
'title' => 'Panel prep',
'type' => 'town_hall',
'status' => 'live',
'scheduled_at' => now()->addHour(),
'timezone' => 'UTC',
'settings' => config('meet.default_settings'),
]);
$greenSession = Session::create([
'owner_ref' => $this->user->public_id,
'room_id' => $room->id,
'media_room_name' => 'meet-'.$room->uuid.'-green',
'status' => 'live',
'session_mode' => 'green_room',
'presenter_refs' => [$this->user->public_id],
'started_at' => now(),
]);
$hostParticipant = \App\Models\Participant::create([
'owner_ref' => $this->user->public_id,
'session_id' => $greenSession->id,
'user_ref' => $this->user->public_id,
'display_name' => $this->user->name,
'role' => 'host',
'status' => 'joined',
'joined_at' => now(),
]);
app(\App\Services\Meet\TownHallService::class)->goLive($greenSession, $this->user);
$liveSession = Session::query()
->where('room_id', $room->id)
->where('session_mode', 'live')
->firstOrFail();
$this->actingAs($this->user)
->withSession(["meet.participant.{$greenSession->uuid}" => $hostParticipant->uuid])
->getJson(route('meet.room.poll', $greenSession))
->assertOk()
->assertJson([
'ended' => true,
'transition' => 'go_live',
'redirect' => route('meet.room', $liveSession),
]);
}
public function test_host_can_end_conference_and_view_details(): void
{
$room = Room::create([