fix: test notifications to only send it to the right channel

This commit is contained in:
Andras Bacsai
2024-12-11 11:57:56 +01:00
parent c08423395c
commit b442965976
7 changed files with 99 additions and 73 deletions

View File

@@ -154,7 +154,7 @@ class Discord extends Component
public function sendTestNotification()
{
try {
$this->team->notify(new Test);
$this->team->notify(new Test(channel: 'discord'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
return handleError($e, $this);

View File

@@ -106,6 +106,7 @@ class Email extends Component
$this->emails = auth()->user()->email;
$this->settings = $this->team->emailNotificationSettings;
$this->syncData();
$this->testEmailAddress = auth()->user()->email;
} catch (\Throwable $e) {
return handleError($e, $this);
}
@@ -317,7 +318,7 @@ class Email extends Component
'test-email:'.$this->team->id,
$perMinute = 0,
function () {
$this->team?->notify(new Test($this->testEmailAddress));
$this->team?->notify(new Test($this->testEmailAddress, 'email'));
$this->dispatch('success', 'Test Email sent.');
},
$decaySeconds = 10,

View File

@@ -154,7 +154,7 @@ class Slack extends Component
public function sendTestNotification()
{
try {
$this->team->notify(new Test);
$this->team->notify(new Test(channel: 'slack'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
return handleError($e, $this);

View File

@@ -223,7 +223,7 @@ class Telegram extends Component
public function sendTestNotification()
{
try {
$this->team->notify(new Test);
$this->team->notify(new Test(channel: 'telegram'));
$this->dispatch('success', 'Test notification sent.');
} catch (\Throwable $e) {
return handleError($e, $this);