Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: telegram group chat notifications

Andras Bacsaiedc3b014cdd5
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 9e05962bae..8f9c142063 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -1969,10 +1969,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
if (!$this->only_this_server) {
$this->deploy_to_additional_destinations();
}
- if (!isCloud()) {
- // TODO: turn off until we have a better solution
- $this->application->environment->project->team?->notify(new DeploymentSuccess($this->application, $this->deployment_uuid, $this->preview));
- }
+ $this->application->environment->project->team?->notify(new DeploymentSuccess($this->application, $this->deployment_uuid, $this->preview));
}
}
diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.php
index 816dac19dd..e138ac91e7 100644
--- a/app/Notifications/Application/DeploymentSuccess.php
+++ b/app/Notifications/Application/DeploymentSuccess.php
@@ -43,7 +43,12 @@ class DeploymentSuccess extends Notification implements ShouldQueue
public function via(object $notifiable): array
{
- return setNotificationChannels($notifiable, 'deployments');
+ $channels = setNotificationChannels($notifiable, 'deployments');
+ if (isCloud()) {
+ // TODO: Make batch notifications work with email
+ $channels = array_diff($channels, ['App\Notifications\Channels\EmailChannel']);
+ }
+ return $channels;
}
public function toMail(): MailMessage
{
diff --git a/app/Notifications/Channels/TelegramChannel.php b/app/Notifications/Channels/TelegramChannel.php
index 1401bb324f..12695497a0 100644
--- a/app/Notifications/Channels/TelegramChannel.php
+++ b/app/Notifications/Channels/TelegramChannel.php
@@ -14,20 +14,22 @@ class TelegramChannel
$buttons = data_get($data, 'buttons', []);
$telegramToken = data_get($telegramData, 'token');
$chatId = data_get($telegramData, 'chat_id');
- $topicId = null;
+ $topicId = null;
$topicsInstance = get_class($notification);
switch ($topicsInstance) {
- case 'App\Notifications\StatusChange':
- $topicId = data_get($notifiable, 'telegram_notifications_status_changes_message_thread_id');
- break;
case 'App\Notifications\Test':
$topicId = data_get($notifiable, 'telegram_notifications_test_message_thread_id');
break;
- case 'App\Notifications\Deployment':
+ case 'App\Notifications\Application\StatusChanged':
+ $topicId = data_get($notifiable, 'telegram_notifications_status_changes_message_thread_id');
+ break;
+ case 'App\Notifications\Application\DeploymentSuccess':
+ case 'App\Notifications\Application\DeploymentFailed':
$topicId = data_get($notifiable, 'telegram_notifications_deployments_message_thread_id');
break;
- case 'App\Notifications\DatabaseBackup':
+ case 'App\Notifications\Database\BackupSuccess':
+ case 'App\Notifications\Database\BackupFailed':
$topicId = data_get($notifiable, 'telegram_notifications_database_backups_message_thread_id');
break;
}
diff --git a/resources/views/livewire/notifications/telegram.blade.php b/resources/views/livewire/notifications/telegram.blade.php
index 4925b9f753..1d8e1231c5 100644
--- a/resources/views/livewire/notifications/telegram.blade.php
+++ b/resources/views/livewire/notifications/telegram.blade.php
@@ -7,7 +7,7 @@
Save
</x-forms.button>
@if ($team->telegram_enabled)
- <x-forms.button class="dark:text-white normal-case btn btn-xs no-animation btn-primary"
+ <x-forms.button class="normal-case dark:text-white btn btn-xs no-animation btn-primary"
wire:click="sendTestNotification">
Send Test Notifications
</x-forms.button>
@@ -18,40 +18,44 @@
</div>
<div class="flex gap-2">
<x-forms.input type="password"
- helper="Get it from the <a class='inline-block dark:text-white underline' href='https://t.me/botfather' target='_blank'>BotFather Bot</a> on Telegram."
+ helper="Get it from the <a class='inline-block underline dark:text-white' href='https://t.me/botfather' target='_blank'>BotFather Bot</a> on Telegram."
required id="team.telegram_token" label="Token" />
<x-forms.input helper="Recommended to add your bot to a group chat and add its Chat ID here." required
id="team.telegram_chat_id" label="Chat ID" />
</div>
@if (data_get($team, 'telegram_enabled'))
<h2 class="mt-4">Subscribe to events</h2>
- <div class="w-96">
+ <div class="flex flex-col gap-4 w-96">
@if (isDev())
- <div class="w-64">
+ <div class="flex flex-col">
+ <h4>Test Notification</h4>
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_test"
- label="Test" />
+ label="Enabled" />
<x-forms.input
helper="If you are using Group chat with Topics, you can specify the topics ID. If empty, General topic will be used."
id="team.telegram_notifications_test_message_thread_id" label="Custom Topic ID" />
</div>
@endif
- <div class="w-64">
+ <div class="flex flex-col">
+ <h4>Container Status Changes</h4>
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_status_changes"
- label="Container Status Changes" />
+ label="Enabled" />
<x-forms.input
helper="If you are using Group chat with Topics, you can specify the topics ID. If empty, General topic will be used."
id="team.telegram_notifications_status_changes_message_thread_id" label="Custom Topic ID" />
</div>
- <div class="w-64">
+ <div class="flex flex-col">
+ <h4>Application Deployments</h4>
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_deployments"
- label="Application Deployments" />
+ label="Enabled" />
<x-forms.input
helper="If you are using Group chat with Topics, you can specify the topics ID. If empty, General topic will be used."
id="team.telegram_notifications_deployments_message_thread_id" label="Custom Topic ID" />
</div>
- <div class="w-64">
+ <div class="flex flex-col">
+ <h4>Database Backup Status</h4>
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_database_backups"
- label="Backup Status" />
+ label="Enabled" />
<x-forms.input
helper="If you are using Group chat with Topics, you can specify the topics ID. If empty, General topic will be used."
id="team.telegram_notifications_database_backups_message_thread_id" label="Custom Topic ID" />