diff --git a/app/Jobs/SendMessageToSlackJob.php b/app/Jobs/SendMessageToSlackJob.php index b78088f50..470002d23 100644 --- a/app/Jobs/SendMessageToSlackJob.php +++ b/app/Jobs/SendMessageToSlackJob.php @@ -18,6 +18,7 @@ class SendMessageToSlackJob implements ShouldQueue private SlackMessage $message, private string $webhookUrl ) { + $this->onQueue('high'); } public function handle(): void @@ -28,7 +29,7 @@ class SendMessageToSlackJob implements ShouldQueue 'type' => 'section', 'text' => [ 'type' => 'plain_text', - 'text' => "Coolify Notification", + 'text' => 'Coolify Notification', ], ], ], @@ -47,12 +48,12 @@ class SendMessageToSlackJob implements ShouldQueue 'type' => 'section', 'text' => [ 'type' => 'mrkdwn', - 'text' => $this->message->description - ] - ] - ] - ] - ] + 'text' => $this->message->description, + ], + ], + ], + ], + ], ]); } -} \ No newline at end of file +} diff --git a/app/Notifications/Channels/SlackChannel.php b/app/Notifications/Channels/SlackChannel.php index 0d359ef5f..32fdbe9cf 100644 --- a/app/Notifications/Channels/SlackChannel.php +++ b/app/Notifications/Channels/SlackChannel.php @@ -14,9 +14,9 @@ class SlackChannel { $message = $notification->toSlack(); $webhookUrl = $notifiable->routeNotificationForSlack(); - if (!$webhookUrl) { + if (! $webhookUrl) { return; } - dispatch(new SendMessageToSlackJob($message, $webhookUrl))->onQueue('high'); + SendMessageToSlackJob::dispatch($message, $webhookUrl); } -} \ No newline at end of file +} diff --git a/app/Notifications/Test.php b/app/Notifications/Test.php index ce998d9f6..03f6c3296 100644 --- a/app/Notifications/Test.php +++ b/app/Notifications/Test.php @@ -51,7 +51,7 @@ class Test extends Notification implements ShouldQueue color: DiscordMessage::successColor(), ); - $message->addField(name: 'Dashboard', value: '[Link](' . base_url() . ')', inline: true); + $message->addField(name: 'Dashboard', value: '[Link]('.base_url().')', inline: true); return $message; } diff --git a/database/migrations/2024_11_12_213200_add_slack_notifications_to_teams_table.php b/database/migrations/2024_11_12_213200_add_slack_notifications_to_teams_table.php index c3896a053..a6457269a 100644 --- a/database/migrations/2024_11_12_213200_add_slack_notifications_to_teams_table.php +++ b/database/migrations/2024_11_12_213200_add_slack_notifications_to_teams_table.php @@ -4,18 +4,19 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up(): void { Schema::table('teams', function (Blueprint $table) { $table->boolean('slack_enabled')->default(false); $table->string('slack_webhook_url')->nullable(); - $table->boolean('slack_notifications_test')->default(false); - $table->boolean('slack_notifications_deployments')->default(false); - $table->boolean('slack_notifications_status_changes')->default(false); - $table->boolean('slack_notifications_database_backups')->default(false); - $table->boolean('slack_notifications_scheduled_tasks')->default(false); - $table->boolean('slack_notifications_server_disk_usage')->default(false); + $table->boolean('slack_notifications_test')->default(true); + $table->boolean('slack_notifications_deployments')->default(true); + $table->boolean('slack_notifications_status_changes')->default(true); + $table->boolean('slack_notifications_database_backups')->default(true); + $table->boolean('slack_notifications_scheduled_tasks')->default(true); + $table->boolean('slack_notifications_server_disk_usage')->default(true); }); } @@ -34,4 +35,4 @@ return new class extends Migration { ]); }); } -}; \ No newline at end of file +};