Skip to content

Commit 4f84a6a

Browse files
authored
[Chore] Deprecate general settings site name (alexjustesen#1332)
1 parent 5534441 commit 4f84a6a

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

app/Filament/Pages/Settings/GeneralPage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function form(Form $form): Form
4949
Forms\Components\Section::make('Site Settings')
5050
->schema([
5151
Forms\Components\TextInput::make('site_name')
52-
->maxLength(50)
53-
->required()
52+
->disabled()
53+
->helperText(new HtmlString('⚠️ DEPRECATED: Use <code>APP_NAME</code> environment variable.'))
5454
->columnSpanFull(),
5555
Forms\Components\Toggle::make('public_dashboard_enabled')
5656
->label('Public dashboard'),

app/Listeners/Webhook/SendSpeedtestCompletedNotification.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Listeners\Webhook;
44

55
use App\Events\SpeedtestCompleted;
6-
use App\Settings\GeneralSettings;
76
use App\Settings\NotificationSettings;
87
use Illuminate\Support\Facades\Log;
98
use Spatie\WebhookServer\WebhookCall;
@@ -15,8 +14,6 @@ class SendSpeedtestCompletedNotification
1514
*/
1615
public function handle(SpeedtestCompleted $event): void
1716
{
18-
$generalSettings = new GeneralSettings();
19-
2017
$notificationSettings = new NotificationSettings();
2118

2219
if (! $notificationSettings->webhook_enabled) {
@@ -38,7 +35,7 @@ public function handle(SpeedtestCompleted $event): void
3835
->url($url['url'])
3936
->payload([
4037
'result_id' => $event->result->id,
41-
'site_name' => $generalSettings->site_name,
38+
'site_name' => config('app.name'),
4239
'ping' => $event->result->ping,
4340
'download' => $event->result->downloadBits,
4441
'upload' => $event->result->uploadBits,

app/Listeners/Webhook/SendSpeedtestThresholdNotification.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use App\Events\SpeedtestCompleted;
66
use App\Helpers\Number;
7-
use App\Settings\GeneralSettings;
87
use App\Settings\NotificationSettings;
98
use App\Settings\ThresholdSettings;
109
use Illuminate\Support\Facades\Log;
@@ -33,8 +32,6 @@ public function handle(SpeedtestCompleted $event): void
3332
return;
3433
}
3534

36-
$generalSettings = new GeneralSettings();
37-
3835
$thresholdSettings = new ThresholdSettings();
3936

4037
if (! $thresholdSettings->absolute_enabled) {
@@ -68,7 +65,7 @@ public function handle(SpeedtestCompleted $event): void
6865
->url($url['url'])
6966
->payload([
7067
'result_id' => $event->result->id,
71-
'site_name' => $generalSettings->site_name,
68+
'site_name' => config('app.name'),
7269
'metrics' => $failed,
7370
])
7471
->doNotSign()

app/Settings/GeneralSettings.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class GeneralSettings extends Settings
1515
/** @var string[] */
1616
public $speedtest_server;
1717

18+
/**
19+
* @deprecated Use APP_NAME environment variable.
20+
*/
1821
public string $site_name;
1922

2023
public string $time_format;

app/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function absolutePingThresholdFailed(float $threshold, float $ping): bool
6262
* @deprecated
6363
*
6464
* @param string $data
65-
* @return bool
65+
* @return bool
6666
*/
6767
if (! function_exists('json_validate')) {
6868
function json_validate($data)

0 commit comments

Comments
 (0)