Redirect participants to meeting ended screen instead of 404.
Deploy Ladill Meet / deploy (push) Successful in 49s
Deploy Ladill Meet / deploy (push) Successful in 49s
Poll and waiting-room clients follow the same redirect when the host ends the call; chat and participants use mobile bottom sheets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -181,8 +181,15 @@ class JoinController extends Controller
|
||||
{
|
||||
$room->loadMissing('organization');
|
||||
|
||||
$session = $room->activeSession();
|
||||
abort_unless($session?->isLive(), 404);
|
||||
$session = $room->activeSession() ?? $this->participantSessionForRoom($request, $room);
|
||||
|
||||
if (! $session || ! $session->isLive()) {
|
||||
if ($session) {
|
||||
return redirect()->route('meet.ended', $session);
|
||||
}
|
||||
|
||||
return redirect()->route('meet.join', $room);
|
||||
}
|
||||
|
||||
$participant = $this->participantFromSession($request, $session);
|
||||
|
||||
@@ -204,8 +211,18 @@ class JoinController extends Controller
|
||||
|
||||
public function waitingStatus(Request $request, Room $room): JsonResponse
|
||||
{
|
||||
$session = $room->activeSession();
|
||||
abort_unless($session, 404);
|
||||
$session = $room->activeSession() ?? $this->participantSessionForRoom($request, $room);
|
||||
|
||||
if (! $session || ! $session->isLive()) {
|
||||
if ($session) {
|
||||
return response()->json([
|
||||
'ended' => true,
|
||||
'redirect' => route('meet.ended', $session),
|
||||
]);
|
||||
}
|
||||
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$participant = $this->participantFromSession($request, $session);
|
||||
|
||||
@@ -230,4 +247,15 @@ class JoinController extends Controller
|
||||
->where('session_id', $session->id)
|
||||
->first();
|
||||
}
|
||||
|
||||
protected function participantSessionForRoom(Request $request, Room $room): ?Session
|
||||
{
|
||||
foreach ($room->sessions()->orderByDesc('started_at')->get() as $session) {
|
||||
if ($request->session()->has("meet.participant.{$session->uuid}")) {
|
||||
return $session;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,50 @@ class LeaveController extends Controller
|
||||
'organization' => $session->room->organization,
|
||||
]);
|
||||
}
|
||||
|
||||
public function ended(Request $request, Session $session): View|RedirectResponse
|
||||
{
|
||||
$session->loadMissing('room.organization');
|
||||
abort_unless($session->room, 404);
|
||||
|
||||
if ($session->isLive()) {
|
||||
return redirect()->route('meet.room', $session);
|
||||
}
|
||||
|
||||
$canGiveFeedback = $this->prepareFeedbackSession($request, $session);
|
||||
|
||||
return view('meet.ended.show', [
|
||||
'session' => $session,
|
||||
'room' => $session->room,
|
||||
'organization' => $session->room->organization,
|
||||
'canGiveFeedback' => $canGiveFeedback,
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareFeedbackSession(Request $request, Session $session): bool
|
||||
{
|
||||
$participantUuid = $request->session()->get("meet.participant.{$session->uuid}");
|
||||
|
||||
if ($participantUuid) {
|
||||
$participant = Participant::where('uuid', $participantUuid)
|
||||
->where('session_id', $session->id)
|
||||
->first();
|
||||
|
||||
if ($participant) {
|
||||
$request->session()->put('meet.left.feedback', [
|
||||
'session_uuid' => $session->uuid,
|
||||
'participant_uuid' => $participant->uuid,
|
||||
'display_name' => $participant->display_name,
|
||||
'user_ref' => $participant->user_ref,
|
||||
]);
|
||||
$request->session()->forget("meet.participant.{$session->uuid}");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$feedback = (array) $request->session()->get('meet.left.feedback', []);
|
||||
|
||||
return ($feedback['session_uuid'] ?? null) === $session->uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,9 @@ class MeetingRoomController extends Controller
|
||||
|
||||
public function show(Request $request, Session $session): View|RedirectResponse
|
||||
{
|
||||
abort_unless($session->isLive(), 404, 'Meeting has ended.');
|
||||
if (! $session->isLive()) {
|
||||
return redirect()->route('meet.ended', $session);
|
||||
}
|
||||
|
||||
$participantUuid = $request->session()->get("meet.participant.{$session->uuid}");
|
||||
abort_unless($participantUuid, 403, 'Please join the meeting first.');
|
||||
@@ -156,6 +158,13 @@ class MeetingRoomController extends Controller
|
||||
|
||||
public function poll(Request $request, Session $session): JsonResponse
|
||||
{
|
||||
if (! $session->isLive()) {
|
||||
return response()->json([
|
||||
'ended' => true,
|
||||
'redirect' => route('meet.ended', $session),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->currentParticipant($request, $session);
|
||||
|
||||
$session->load(['participants' => fn ($q) => $q->whereIn('status', ['joined', 'waiting'])]);
|
||||
|
||||
Reference in New Issue
Block a user