fix(database): guard proxy listeners without a team

This commit is contained in:
Andras Bacsai 2026-05-28 17:13:18 +02:00
parent 27b76a4e97
commit c35d28f99b
4 changed files with 32 additions and 11 deletions

View file

@ -42,12 +42,19 @@ class General extends Component
public bool $isLogDrainEnabled = false; public bool $isLogDrainEnabled = false;
public function getListeners() public function getListeners(): array
{ {
$teamId = Auth::user()->currentTeam()->id; $user = Auth::user();
if (! $user) {
return [];
}
$team = $user->currentTeam();
if (! $team) {
return [];
}
return [ return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', "echo-private:team.{$team->id},DatabaseProxyStopped" => 'databaseProxyStopped',
]; ];
} }

View file

@ -40,12 +40,19 @@ class General extends Component
public bool $isLogDrainEnabled = false; public bool $isLogDrainEnabled = false;
public function getListeners() public function getListeners(): array
{ {
$teamId = Auth::user()->currentTeam()->id; $user = Auth::user();
if (! $user) {
return [];
}
$team = $user->currentTeam();
if (! $team) {
return [];
}
return [ return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', "echo-private:team.{$team->id},DatabaseProxyStopped" => 'databaseProxyStopped',
]; ];
} }

View file

@ -42,12 +42,19 @@ class General extends Component
public bool $isLogDrainEnabled = false; public bool $isLogDrainEnabled = false;
public function getListeners() public function getListeners(): array
{ {
$teamId = Auth::user()->currentTeam()->id; $user = Auth::user();
if (! $user) {
return [];
}
$team = $user->currentTeam();
if (! $team) {
return [];
}
return [ return [
"echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', "echo-private:team.{$team->id},DatabaseProxyStopped" => 'databaseProxyStopped',
]; ];
} }

View file

@ -63,7 +63,7 @@
@else @else
<x-forms.checkbox id="enableSsl" label="Enable SSL" wire:model.live="enableSsl" <x-forms.checkbox id="enableSsl" label="Enable SSL" wire:model.live="enableSsl"
instantSave="instantSaveSSL" disabled instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." canGate="update" helper="Database should be stopped to change this setting." canGate="update"
:canResource="$database" /> :canResource="$database" />
@endif @endif
</div> </div>
@ -79,7 +79,7 @@
</x-forms.select> </x-forms.select>
@else @else
<x-forms.select id="sslMode" label="SSL Mode" instantSave="instantSaveSSL" disabled <x-forms.select id="sslMode" label="SSL Mode" instantSave="instantSaveSSL" disabled
helper="Database should be stopped to change this settings." canGate="update" helper="Database should be stopped to change this setting." canGate="update"
:canResource="$database"> :canResource="$database">
@foreach ($sslModeOptions as $value => $option) @foreach ($sslModeOptions as $value => $option)
<option value="{{ $value }}" title="{{ $option['title'] ?? '' }}">{{ $option['label'] }}</option> <option value="{{ $value }}" title="{{ $option['title'] ?? '' }}">{{ $option['label'] }}</option>