Files
ladill-meet/app/Services/Meet/SpaceService.php
T
isaaccladandCursor c51e59945e
Deploy Ladill Meet / deploy (push) Successful in 1m3s
Limit audio rooms to Twitter Spaces features and fix live toolbar UX.
Block breakouts, chat, Q&A, and other meeting-only tools in spaces, hide video controls for audio-only rooms, and stabilize mobile nav and toolbar layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 00:25:40 +00:00

75 lines
1.8 KiB
PHP

<?php
namespace App\Services\Meet;
use App\Models\Participant;
use App\Models\Room;
use App\Models\User;
class SpaceService
{
/**
* Resolve participant role for an audio-only room join.
*/
public function resolveJoinRole(Room $room, ?User $user, string $fallbackRole = 'guest'): string
{
if ($room->type !== 'space') {
return $fallbackRole;
}
if ($user && $user->ownerRef() === $room->host_user_ref) {
return 'host';
}
$speakerRefs = (array) $room->setting('speaker_refs', []);
if ($user && in_array($user->ownerRef(), $speakerRefs, true)) {
return 'panelist';
}
return 'attendee';
}
public function canPublish(Room $room, Participant $participant): bool
{
if ($room->type !== 'space') {
return true;
}
return in_array($participant->role, ['host', 'co_host', 'panelist'], true);
}
public function isListener(Room $room, Participant $participant): bool
{
return $room->type === 'space' && $participant->role === 'attendee';
}
public function isAudioOnly(Room $room): bool
{
return $room->isSpace() || (bool) $room->setting('audio_only', false);
}
/**
* Whether a live-room feature is available for this room type.
* Audio rooms (Spaces) mirror Twitter Spaces — no breakouts, chat, Q&A, etc.
*/
public function allowsRoomFeature(Room $room, string $feature): bool
{
if (! $room->isSpace()) {
return true;
}
return ! in_array($feature, [
'breakouts',
'chat',
'qa',
'polls',
'files',
'whiteboard',
'programme',
'live_stream',
'lock',
], true);
}
}