From 6d1c153d09cb039a6ad0c93a1828b548118ffc0e Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:27:07 +0100 Subject: [PATCH] Add config panel.editable_server_descriptions check (#734) * Add config panel.editable_server_descriptions check * Hide the field rather then disabling it --- app/Filament/Server/Pages/Settings.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Filament/Server/Pages/Settings.php b/app/Filament/Server/Pages/Settings.php index 1095c8e06c..c4d01a09f5 100644 --- a/app/Filament/Server/Pages/Settings.php +++ b/app/Filament/Server/Pages/Settings.php @@ -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, @@ -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;