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

@@ -3,8 +3,10 @@
namespace App\Livewire;
use App\Models\InstanceSettings;
use App\Models\Team;
use App\Notifications\Test;
use Illuminate\Support\Facades\RateLimiter;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
@@ -12,6 +14,9 @@ class SettingsEmail extends Component
{
public InstanceSettings $settings;
#[Locked]
public Team $team;
#[Validate(['boolean'])]
public bool $smtpEnabled = false;
@@ -58,6 +63,8 @@ class SettingsEmail extends Component
}
$this->settings = instanceSettings();
$this->syncData();
$this->team = auth()->user()->currentTeam();
$this->testEmailAddress = auth()->user()->email;
}
public function syncData(bool $toModel = false)
@@ -219,7 +226,7 @@ class SettingsEmail 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,