Skip to content

Commit

Permalink
Add config panel.editable_server_descriptions check (#734)
Browse files Browse the repository at this point in the history
* Add config panel.editable_server_descriptions check

* Hide the field rather then disabling it
  • Loading branch information
RMartinOscar authored Dec 1, 2024
1 parent e5433b7 commit 6d1c153
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Filament/Server/Pages/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function form(Form $form): Form
->afterStateUpdated(fn ($state, Server $server) => $this->updateName($state, $server)),
Textarea::make('description')
->label('Server Description')
->hidden(!config('panel.editable_server_descriptions'))
->disabled(!auth()->user()->can(Permission::ACTION_SETTINGS_RENAME, $server))
->columnSpan([
'default' => 1,
Expand Down Expand Up @@ -239,7 +240,7 @@ public function updateName(string $name, Server $server): void

public function updateDescription(string $description, Server $server): void
{
abort_unless(auth()->user()->can(Permission::ACTION_SETTINGS_RENAME, $server), 403);
abort_unless(auth()->user()->can(Permission::ACTION_SETTINGS_RENAME, $server) && config('panel.editable_server_descriptions'), 403);

$original = $server->description;

Expand Down

0 comments on commit 6d1c153

Please sign in to comment.