chore: rename topicID to threadId like in the telegram API response

This commit is contained in:
peaklabs-dev
2024-12-11 23:13:13 +01:00
parent 09746aa877
commit f88438edd3
7 changed files with 125 additions and 124 deletions

View File

@@ -32,7 +32,7 @@ class SendMessageToTelegramJob implements ShouldBeEncrypted, ShouldQueue
public array $buttons, public array $buttons,
public string $token, public string $token,
public string $chatId, public string $chatId,
public ?string $topicId = null, public ?string $threadId = null,
) { ) {
$this->onQueue('high'); $this->onQueue('high');
} }
@@ -67,8 +67,8 @@ class SendMessageToTelegramJob implements ShouldBeEncrypted, ShouldQueue
'chat_id' => $this->chatId, 'chat_id' => $this->chatId,
'text' => $this->text, 'text' => $this->text,
]; ];
if ($this->topicId) { if ($this->threadId) {
$payload['message_thread_id'] = $this->topicId; $payload['message_thread_id'] = $this->threadId;
} }
$response = Http::post($url, $payload); $response = Http::post($url, $payload);
if ($response->failed()) { if ($response->failed()) {

View File

@@ -65,40 +65,40 @@ class Telegram extends Component
public bool $serverUnreachableTelegramNotifications = true; public bool $serverUnreachableTelegramNotifications = true;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsDeploymentSuccessTopicId = null; public ?string $telegramNotificationsDeploymentSuccessThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsDeploymentFailureTopicId = null; public ?string $telegramNotificationsDeploymentFailureThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsStatusChangeTopicId = null; public ?string $telegramNotificationsStatusChangeThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsBackupSuccessTopicId = null; public ?string $telegramNotificationsBackupSuccessThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsBackupFailureTopicId = null; public ?string $telegramNotificationsBackupFailureThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsScheduledTaskSuccessTopicId = null; public ?string $telegramNotificationsScheduledTaskSuccessThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsScheduledTaskFailureTopicId = null; public ?string $telegramNotificationsScheduledTaskFailureThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsDockerCleanupSuccessTopicId = null; public ?string $telegramNotificationsDockerCleanupSuccessThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsDockerCleanupFailureTopicId = null; public ?string $telegramNotificationsDockerCleanupFailureThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsServerDiskUsageTopicId = null; public ?string $telegramNotificationsServerDiskUsageThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsServerReachableTopicId = null; public ?string $telegramNotificationsServerReachableThreadId = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]
public ?string $telegramNotificationsServerUnreachableTopicId = null; public ?string $telegramNotificationsServerUnreachableThreadId = null;
public function mount() public function mount()
{ {
@@ -132,18 +132,18 @@ class Telegram extends Component
$this->settings->server_reachable_telegram_notifications = $this->serverReachableTelegramNotifications; $this->settings->server_reachable_telegram_notifications = $this->serverReachableTelegramNotifications;
$this->settings->server_unreachable_telegram_notifications = $this->serverUnreachableTelegramNotifications; $this->settings->server_unreachable_telegram_notifications = $this->serverUnreachableTelegramNotifications;
$this->settings->telegram_notifications_deployment_success_topic_id = $this->telegramNotificationsDeploymentSuccessTopicId; $this->settings->telegram_notifications_deployment_success_thread_id = $this->telegramNotificationsDeploymentSuccessThreadId;
$this->settings->telegram_notifications_deployment_failure_topic_id = $this->telegramNotificationsDeploymentFailureTopicId; $this->settings->telegram_notifications_deployment_failure_thread_id = $this->telegramNotificationsDeploymentFailureThreadId;
$this->settings->telegram_notifications_status_change_topic_id = $this->telegramNotificationsStatusChangeTopicId; $this->settings->telegram_notifications_status_change_thread_id = $this->telegramNotificationsStatusChangeThreadId;
$this->settings->telegram_notifications_backup_success_topic_id = $this->telegramNotificationsBackupSuccessTopicId; $this->settings->telegram_notifications_backup_success_thread_id = $this->telegramNotificationsBackupSuccessThreadId;
$this->settings->telegram_notifications_backup_failure_topic_id = $this->telegramNotificationsBackupFailureTopicId; $this->settings->telegram_notifications_backup_failure_thread_id = $this->telegramNotificationsBackupFailureThreadId;
$this->settings->telegram_notifications_scheduled_task_success_topic_id = $this->telegramNotificationsScheduledTaskSuccessTopicId; $this->settings->telegram_notifications_scheduled_task_success_thread_id = $this->telegramNotificationsScheduledTaskSuccessThreadId;
$this->settings->telegram_notifications_scheduled_task_failure_topic_id = $this->telegramNotificationsScheduledTaskFailureTopicId; $this->settings->telegram_notifications_scheduled_task_failure_thread_id = $this->telegramNotificationsScheduledTaskFailureThreadId;
$this->settings->telegram_notifications_docker_cleanup_success_topic_id = $this->telegramNotificationsDockerCleanupSuccessTopicId; $this->settings->telegram_notifications_docker_cleanup_success_thread_id = $this->telegramNotificationsDockerCleanupSuccessThreadId;
$this->settings->telegram_notifications_docker_cleanup_failure_topic_id = $this->telegramNotificationsDockerCleanupFailureTopicId; $this->settings->telegram_notifications_docker_cleanup_failure_thread_id = $this->telegramNotificationsDockerCleanupFailureThreadId;
$this->settings->telegram_notifications_server_disk_usage_topic_id = $this->telegramNotificationsServerDiskUsageTopicId; $this->settings->telegram_notifications_server_disk_usage_thread_id = $this->telegramNotificationsServerDiskUsageThreadId;
$this->settings->telegram_notifications_server_reachable_topic_id = $this->telegramNotificationsServerReachableTopicId; $this->settings->telegram_notifications_server_reachable_thread_id = $this->telegramNotificationsServerReachableThreadId;
$this->settings->telegram_notifications_server_unreachable_topic_id = $this->telegramNotificationsServerUnreachableTopicId; $this->settings->telegram_notifications_server_unreachable_thread_id = $this->telegramNotificationsServerUnreachableThreadId;
$this->settings->save(); $this->settings->save();
} else { } else {
@@ -164,18 +164,18 @@ class Telegram extends Component
$this->serverReachableTelegramNotifications = $this->settings->server_reachable_telegram_notifications; $this->serverReachableTelegramNotifications = $this->settings->server_reachable_telegram_notifications;
$this->serverUnreachableTelegramNotifications = $this->settings->server_unreachable_telegram_notifications; $this->serverUnreachableTelegramNotifications = $this->settings->server_unreachable_telegram_notifications;
$this->telegramNotificationsDeploymentSuccessTopicId = $this->settings->telegram_notifications_deployment_success_topic_id; $this->telegramNotificationsDeploymentSuccessThreadId = $this->settings->telegram_notifications_deployment_success_thread_id;
$this->telegramNotificationsDeploymentFailureTopicId = $this->settings->telegram_notifications_deployment_failure_topic_id; $this->telegramNotificationsDeploymentFailureThreadId = $this->settings->telegram_notifications_deployment_failure_thread_id;
$this->telegramNotificationsStatusChangeTopicId = $this->settings->telegram_notifications_status_change_topic_id; $this->telegramNotificationsStatusChangeThreadId = $this->settings->telegram_notifications_status_change_thread_id;
$this->telegramNotificationsBackupSuccessTopicId = $this->settings->telegram_notifications_backup_success_topic_id; $this->telegramNotificationsBackupSuccessThreadId = $this->settings->telegram_notifications_backup_success_thread_id;
$this->telegramNotificationsBackupFailureTopicId = $this->settings->telegram_notifications_backup_failure_topic_id; $this->telegramNotificationsBackupFailureThreadId = $this->settings->telegram_notifications_backup_failure_thread_id;
$this->telegramNotificationsScheduledTaskSuccessTopicId = $this->settings->telegram_notifications_scheduled_task_success_topic_id; $this->telegramNotificationsScheduledTaskSuccessThreadId = $this->settings->telegram_notifications_scheduled_task_success_thread_id;
$this->telegramNotificationsScheduledTaskFailureTopicId = $this->settings->telegram_notifications_scheduled_task_failure_topic_id; $this->telegramNotificationsScheduledTaskFailureThreadId = $this->settings->telegram_notifications_scheduled_task_failure_thread_id;
$this->telegramNotificationsDockerCleanupSuccessTopicId = $this->settings->telegram_notifications_docker_cleanup_success_topic_id; $this->telegramNotificationsDockerCleanupSuccessThreadId = $this->settings->telegram_notifications_docker_cleanup_success_thread_id;
$this->telegramNotificationsDockerCleanupFailureTopicId = $this->settings->telegram_notifications_docker_cleanup_failure_topic_id; $this->telegramNotificationsDockerCleanupFailureThreadId = $this->settings->telegram_notifications_docker_cleanup_failure_thread_id;
$this->telegramNotificationsServerDiskUsageTopicId = $this->settings->telegram_notifications_server_disk_usage_topic_id; $this->telegramNotificationsServerDiskUsageThreadId = $this->settings->telegram_notifications_server_disk_usage_thread_id;
$this->telegramNotificationsServerReachableTopicId = $this->settings->telegram_notifications_server_reachable_topic_id; $this->telegramNotificationsServerReachableThreadId = $this->settings->telegram_notifications_server_reachable_thread_id;
$this->telegramNotificationsServerUnreachableTopicId = $this->settings->telegram_notifications_server_unreachable_topic_id; $this->telegramNotificationsServerUnreachableThreadId = $this->settings->telegram_notifications_server_unreachable_thread_id;
} }
} }

View File

@@ -30,17 +30,17 @@ class TelegramNotificationSettings extends Model
'server_reachable_telegram_notifications', 'server_reachable_telegram_notifications',
'server_unreachable_telegram_notifications', 'server_unreachable_telegram_notifications',
'telegram_notifications_deployment_success_topic_id', 'telegram_notifications_deployment_success_thread_id',
'telegram_notifications_deployment_failure_topic_id', 'telegram_notifications_deployment_failure_thread_id',
'telegram_notifications_status_change_topic_id', 'telegram_notifications_status_change_thread_id',
'telegram_notifications_backup_success_topic_id', 'telegram_notifications_backup_success_thread_id',
'telegram_notifications_backup_failure_topic_id', 'telegram_notifications_backup_failure_thread_id',
'telegram_notifications_scheduled_task_success_topic_id', 'telegram_notifications_scheduled_task_success_thread_id',
'telegram_notifications_scheduled_task_failure_topic_id', 'telegram_notifications_scheduled_task_failure_thread_id',
'telegram_notifications_docker_cleanup_topic_id', 'telegram_notifications_docker_cleanup_thread_id',
'telegram_notifications_server_disk_usage_topic_id', 'telegram_notifications_server_disk_usage_thread_id',
'telegram_notifications_server_reachable_topic_id', 'telegram_notifications_server_reachable_thread_id',
'telegram_notifications_server_unreachable_topic_id', 'telegram_notifications_server_unreachable_thread_id',
]; ];
protected $casts = [ protected $casts = [
@@ -60,17 +60,17 @@ class TelegramNotificationSettings extends Model
'server_reachable_telegram_notifications' => 'boolean', 'server_reachable_telegram_notifications' => 'boolean',
'server_unreachable_telegram_notifications' => 'boolean', 'server_unreachable_telegram_notifications' => 'boolean',
'telegram_notifications_deployment_success_topic_id' => 'encrypted', 'telegram_notifications_deployment_success_thread_id' => 'encrypted',
'telegram_notifications_deployment_failure_topic_id' => 'encrypted', 'telegram_notifications_deployment_failure_thread_id' => 'encrypted',
'telegram_notifications_status_change_topic_id' => 'encrypted', 'telegram_notifications_status_change_thread_id' => 'encrypted',
'telegram_notifications_backup_success_topic_id' => 'encrypted', 'telegram_notifications_backup_success_thread_id' => 'encrypted',
'telegram_notifications_backup_failure_topic_id' => 'encrypted', 'telegram_notifications_backup_failure_thread_id' => 'encrypted',
'telegram_notifications_scheduled_task_success_topic_id' => 'encrypted', 'telegram_notifications_scheduled_task_success_thread_id' => 'encrypted',
'telegram_notifications_scheduled_task_failure_topic_id' => 'encrypted', 'telegram_notifications_scheduled_task_failure_thread_id' => 'encrypted',
'telegram_notifications_docker_cleanup_topic_id' => 'encrypted', 'telegram_notifications_docker_cleanup_thread_id' => 'encrypted',
'telegram_notifications_server_disk_usage_topic_id' => 'encrypted', 'telegram_notifications_server_disk_usage_thread_id' => 'encrypted',
'telegram_notifications_server_reachable_topic_id' => 'encrypted', 'telegram_notifications_server_reachable_thread_id' => 'encrypted',
'telegram_notifications_server_unreachable_topic_id' => 'encrypted', 'telegram_notifications_server_unreachable_thread_id' => 'encrypted',
]; ];
public function team() public function team()

View File

@@ -16,24 +16,24 @@ class TelegramChannel
$telegramToken = $settings->telegram_token; $telegramToken = $settings->telegram_token;
$chatId = $settings->telegram_chat_id; $chatId = $settings->telegram_chat_id;
$topicId = match (get_class($notification)) { $threadId = match (get_class($notification)) {
\App\Notifications\Application\DeploymentSuccess::class => $settings->telegram_notifications_deployment_success_topic_id, \App\Notifications\Application\DeploymentSuccess::class => $settings->telegram_notifications_deployment_success_thread_id,
\App\Notifications\Application\DeploymentFailed::class => $settings->telegram_notifications_deployment_failure_topic_id, \App\Notifications\Application\DeploymentFailed::class => $settings->telegram_notifications_deployment_failure_thread_id,
\App\Notifications\Application\StatusChanged::class, \App\Notifications\Application\StatusChanged::class,
\App\Notifications\Container\ContainerRestarted::class, \App\Notifications\Container\ContainerRestarted::class,
\App\Notifications\Container\ContainerStopped::class => $settings->telegram_notifications_status_change_topic_id, \App\Notifications\Container\ContainerStopped::class => $settings->telegram_notifications_status_change_thread_id,
\App\Notifications\Database\BackupSuccess::class => $settings->telegram_notifications_backup_success_topic_id, \App\Notifications\Database\BackupSuccess::class => $settings->telegram_notifications_backup_success_thread_id,
\App\Notifications\Database\BackupFailed::class => $settings->telegram_notifications_backup_failure_topic_id, \App\Notifications\Database\BackupFailed::class => $settings->telegram_notifications_backup_failure_thread_id,
\App\Notifications\ScheduledTask\TaskSuccess::class => $settings->telegram_notifications_scheduled_task_success_topic_id, \App\Notifications\ScheduledTask\TaskSuccess::class => $settings->telegram_notifications_scheduled_task_success_thread_id,
\App\Notifications\ScheduledTask\TaskFailed::class => $settings->telegram_notifications_scheduled_task_failure_topic_id, \App\Notifications\ScheduledTask\TaskFailed::class => $settings->telegram_notifications_scheduled_task_failure_thread_id,
\App\Notifications\Server\DockerCleanupSuccess::class => $settings->telegram_notifications_docker_cleanup_success_topic_id, \App\Notifications\Server\DockerCleanupSuccess::class => $settings->telegram_notifications_docker_cleanup_success_thread_id,
\App\Notifications\Server\DockerCleanupFailed::class => $settings->telegram_notifications_docker_cleanup_failure_topic_id, \App\Notifications\Server\DockerCleanupFailed::class => $settings->telegram_notifications_docker_cleanup_failure_thread_id,
\App\Notifications\Server\HighDiskUsage::class => $settings->telegram_notifications_server_disk_usage_topic_id, \App\Notifications\Server\HighDiskUsage::class => $settings->telegram_notifications_server_disk_usage_thread_id,
\App\Notifications\Server\Unreachable::class => $settings->telegram_notifications_server_unreachable_topic_id, \App\Notifications\Server\Unreachable::class => $settings->telegram_notifications_server_unreachable_thread_id,
\App\Notifications\Server\Reachable::class => $settings->telegram_notifications_server_reachable_topic_id, \App\Notifications\Server\Reachable::class => $settings->telegram_notifications_server_reachable_thread_id,
default => null, default => null,
}; };
@@ -42,6 +42,6 @@ class TelegramChannel
return; return;
} }
SendMessageToTelegramJob::dispatch($message, $buttons, $telegramToken, $chatId, $topicId); SendMessageToTelegramJob::dispatch($message, $buttons, $telegramToken, $chatId, $threadId);
} }
} }

View File

@@ -32,18 +32,18 @@ return new class extends Migration
$table->boolean('server_reachable_telegram_notifications')->default(false); $table->boolean('server_reachable_telegram_notifications')->default(false);
$table->boolean('server_unreachable_telegram_notifications')->default(true); $table->boolean('server_unreachable_telegram_notifications')->default(true);
$table->text('telegram_notifications_deployment_success_topic_id')->nullable(); $table->text('telegram_notifications_deployment_success_thread_id')->nullable();
$table->text('telegram_notifications_deployment_failure_topic_id')->nullable(); $table->text('telegram_notifications_deployment_failure_thread_id')->nullable();
$table->text('telegram_notifications_status_change_topic_id')->nullable(); $table->text('telegram_notifications_status_change_thread_id')->nullable();
$table->text('telegram_notifications_backup_success_topic_id')->nullable(); $table->text('telegram_notifications_backup_success_thread_id')->nullable();
$table->text('telegram_notifications_backup_failure_topic_id')->nullable(); $table->text('telegram_notifications_backup_failure_thread_id')->nullable();
$table->text('telegram_notifications_scheduled_task_success_topic_id')->nullable(); $table->text('telegram_notifications_scheduled_task_success_thread_id')->nullable();
$table->text('telegram_notifications_scheduled_task_failure_topic_id')->nullable(); $table->text('telegram_notifications_scheduled_task_failure_thread_id')->nullable();
$table->text('telegram_notifications_docker_cleanup_success_topic_id')->nullable(); $table->text('telegram_notifications_docker_cleanup_success_thread_id')->nullable();
$table->text('telegram_notifications_docker_cleanup_failure_topic_id')->nullable(); $table->text('telegram_notifications_docker_cleanup_failure_thread_id')->nullable();
$table->text('telegram_notifications_server_disk_usage_topic_id')->nullable(); $table->text('telegram_notifications_server_disk_usage_thread_id')->nullable();
$table->text('telegram_notifications_server_reachable_topic_id')->nullable(); $table->text('telegram_notifications_server_reachable_thread_id')->nullable();
$table->text('telegram_notifications_server_unreachable_topic_id')->nullable(); $table->text('telegram_notifications_server_unreachable_thread_id')->nullable();
$table->unique(['team_id']); $table->unique(['team_id']);
}); });

View File

@@ -4,6 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
@@ -30,17 +31,17 @@ return new class extends Migration
'status_change_telegram_notifications' => $team->telegram_notifications_status_changes ?? false, 'status_change_telegram_notifications' => $team->telegram_notifications_status_changes ?? false,
'server_disk_usage_telegram_notifications' => $team->telegram_notifications_server_disk_usage ?? true, 'server_disk_usage_telegram_notifications' => $team->telegram_notifications_server_disk_usage ?? true,
'telegram_notifications_deployment_success_topic_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null, 'telegram_notifications_deployment_success_thread_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null,
'telegram_notifications_deployment_failure_topic_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null, 'telegram_notifications_deployment_failure_thread_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null,
'telegram_notifications_backup_success_topic_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null, 'telegram_notifications_backup_success_thread_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null,
'telegram_notifications_backup_failure_topic_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null, 'telegram_notifications_backup_failure_thread_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null,
'telegram_notifications_scheduled_task_success_topic_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null, 'telegram_notifications_scheduled_task_success_thread_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null,
'telegram_notifications_scheduled_task_failure_topic_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null, 'telegram_notifications_scheduled_task_failure_thread_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null,
'telegram_notifications_status_change_topic_id' => $team->telegram_notifications_status_changes_message_thread_id ? Crypt::encryptString($team->telegram_notifications_status_changes_message_thread_id) : null, 'telegram_notifications_status_change_thread_id' => $team->telegram_notifications_status_changes_message_thread_id ? Crypt::encryptString($team->telegram_notifications_status_changes_message_thread_id) : null,
] ]
); );
} catch (Exception $e) { } catch (Exception $e) {
\Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage()); Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage());
} }
} }
@@ -101,13 +102,13 @@ return new class extends Migration
'telegram_notifications_scheduled_tasks' => $setting->scheduled_task_success_telegram_notifications || $setting->scheduled_task_failure_telegram_notifications, 'telegram_notifications_scheduled_tasks' => $setting->scheduled_task_success_telegram_notifications || $setting->scheduled_task_failure_telegram_notifications,
'telegram_notifications_server_disk_usage' => $setting->server_disk_usage_telegram_notifications, 'telegram_notifications_server_disk_usage' => $setting->server_disk_usage_telegram_notifications,
'telegram_notifications_deployments_message_thread_id' => $setting->telegram_notifications_deployment_success_topic_id ? Crypt::decryptString($setting->telegram_notifications_deployment_success_topic_id) : null, 'telegram_notifications_deployments_message_thread_id' => $setting->telegram_notifications_deployment_success_thread_id ? Crypt::decryptString($setting->telegram_notifications_deployment_success_thread_id) : null,
'telegram_notifications_status_changes_message_thread_id' => $setting->telegram_notifications_status_change_topic_id ? Crypt::decryptString($setting->telegram_notifications_status_change_topic_id) : null, 'telegram_notifications_status_changes_message_thread_id' => $setting->telegram_notifications_status_change_thread_id ? Crypt::decryptString($setting->telegram_notifications_status_change_thread_id) : null,
'telegram_notifications_database_backups_message_thread_id' => $setting->telegram_notifications_backup_success_topic_id ? Crypt::decryptString($setting->telegram_notifications_backup_success_topic_id) : null, 'telegram_notifications_database_backups_message_thread_id' => $setting->telegram_notifications_backup_success_thread_id ? Crypt::decryptString($setting->telegram_notifications_backup_success_thread_id) : null,
'telegram_notifications_scheduled_tasks_thread_id' => $setting->telegram_notifications_scheduled_task_success_topic_id ? Crypt::decryptString($setting->telegram_notifications_scheduled_task_success_topic_id) : null, 'telegram_notifications_scheduled_tasks_thread_id' => $setting->telegram_notifications_scheduled_task_success_thread_id ? Crypt::decryptString($setting->telegram_notifications_scheduled_task_success_thread_id) : null,
]); ]);
} catch (Exception $e) { } catch (Exception $e) {
\Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage()); Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage());
} }
} }
} }

View File

@@ -44,16 +44,16 @@
<x-forms.checkbox instantSave="saveModel" id="deploymentSuccessTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="deploymentSuccessTelegramNotifications"
label="Deployment Success" /> label="Deployment Success" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsDeploymentSuccessTopicId" /> id="telegramNotificationsDeploymentSuccessThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
<div class="w-96"> <div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="deploymentFailureTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="deploymentFailureTelegramNotifications"
label="Deployment Failure" /> label="Deployment Failure" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsDeploymentFailureTopicId" /> id="telegramNotificationsDeploymentFailureThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
<div class="w-96"> <div class="w-96">
@@ -61,8 +61,8 @@
label="Container Status Changes" label="Container Status Changes"
helper="Send a notification when a container status changes. It will send a notification for Stopped and Restarted events of a container." /> helper="Send a notification when a container status changes. It will send a notification for Stopped and Restarted events of a container." />
</div> </div>
<x-forms.input type="password" id="telegramNotificationsStatusChangeTopicId" <x-forms.input type="password" id="telegramNotificationsStatusChangeThreadId"
placeholder="Custom Telegram Topic ID" /> placeholder="Custom Telegram Thread ID" />
</div> </div>
</div> </div>
</div> </div>
@@ -74,8 +74,8 @@
<x-forms.checkbox instantSave="saveModel" id="backupSuccessTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="backupSuccessTelegramNotifications"
label="Backup Success" /> label="Backup Success" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsBackupSuccessTopicId" /> id="telegramNotificationsBackupSuccessThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
@@ -83,8 +83,8 @@
<x-forms.checkbox instantSave="saveModel" id="backupFailureTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="backupFailureTelegramNotifications"
label="Backup Failure" /> label="Backup Failure" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsBackupFailureTopicId" /> id="telegramNotificationsBackupFailureThreadId" />
</div> </div>
</div> </div>
</div> </div>
@@ -97,8 +97,8 @@
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessTelegramNotifications"
label="Scheduled Task Success" /> label="Scheduled Task Success" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsScheduledTaskSuccessTopicId" /> id="telegramNotificationsScheduledTaskSuccessThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
@@ -106,8 +106,8 @@
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureTelegramNotifications"
label="Scheduled Task Failure" /> label="Scheduled Task Failure" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsScheduledTaskFailureTopicId" /> id="telegramNotificationsScheduledTaskFailureThreadId" />
</div> </div>
</div> </div>
</div> </div>
@@ -120,8 +120,8 @@
<x-forms.checkbox instantSave="saveModel" id="dockerCleanupSuccessTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="dockerCleanupSuccessTelegramNotifications"
label="Docker Cleanup Success" /> label="Docker Cleanup Success" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsDockerCleanupSuccessTopicId" /> id="telegramNotificationsDockerCleanupSuccessThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
@@ -129,8 +129,8 @@
<x-forms.checkbox instantSave="saveModel" id="dockerCleanupFailureTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="dockerCleanupFailureTelegramNotifications"
label="Docker Cleanup Failure" /> label="Docker Cleanup Failure" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsDockerCleanupFailureTopicId" /> id="telegramNotificationsDockerCleanupFailureThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
@@ -138,8 +138,8 @@
<x-forms.checkbox instantSave="saveModel" id="serverDiskUsageTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="serverDiskUsageTelegramNotifications"
label="Server Disk Usage" /> label="Server Disk Usage" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsServerDiskUsageTopicId" /> id="telegramNotificationsServerDiskUsageThreadId" />
</div> </div>
<div class="pl-1 flex gap-2"> <div class="pl-1 flex gap-2">
@@ -147,8 +147,8 @@
<x-forms.checkbox instantSave="saveModel" id="serverReachableTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="serverReachableTelegramNotifications"
label="Server Reachable" /> label="Server Reachable" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsServerReachableTopicId" /> id="telegramNotificationsServerReachableThreadId" />
</div> </div>
@@ -157,8 +157,8 @@
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableTelegramNotifications" <x-forms.checkbox instantSave="saveModel" id="serverUnreachableTelegramNotifications"
label="Server Unreachable" /> label="Server Unreachable" />
</div> </div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID" <x-forms.input type="password" placeholder="Custom Telegram Thread ID"
id="telegramNotificationsServerUnreachableTopicId" /> id="telegramNotificationsServerUnreachableThreadId" />
</div> </div>
</div> </div>
</div> </div>