fix(team): include webhook notifications in enabled check (#8557)
This commit is contained in:
commit
58acdccfc9
2 changed files with 54 additions and 1 deletions
|
|
@ -191,7 +191,8 @@ public function isAnyNotificationEnabled()
|
|||
$this->getNotificationSettings('discord')?->isEnabled() ||
|
||||
$this->getNotificationSettings('slack')?->isEnabled() ||
|
||||
$this->getNotificationSettings('telegram')?->isEnabled() ||
|
||||
$this->getNotificationSettings('pushover')?->isEnabled();
|
||||
$this->getNotificationSettings('pushover')?->isEnabled() ||
|
||||
$this->getNotificationSettings('webhook')?->isEnabled();
|
||||
}
|
||||
|
||||
public function subscriptionEnded()
|
||||
|
|
|
|||
52
tests/Feature/TeamNotificationCheckTest.php
Normal file
52
tests/Feature/TeamNotificationCheckTest.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Team;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
$this->team = Team::factory()->create();
|
||||
});
|
||||
|
||||
describe('isAnyNotificationEnabled', function () {
|
||||
test('returns false when no notifications are enabled', function () {
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeFalse();
|
||||
});
|
||||
|
||||
test('returns true when email notifications are enabled', function () {
|
||||
$this->team->emailNotificationSettings->update(['smtp_enabled' => true]);
|
||||
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeTrue();
|
||||
});
|
||||
|
||||
test('returns true when discord notifications are enabled', function () {
|
||||
$this->team->discordNotificationSettings->update(['discord_enabled' => true]);
|
||||
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeTrue();
|
||||
});
|
||||
|
||||
test('returns true when slack notifications are enabled', function () {
|
||||
$this->team->slackNotificationSettings->update(['slack_enabled' => true]);
|
||||
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeTrue();
|
||||
});
|
||||
|
||||
test('returns true when telegram notifications are enabled', function () {
|
||||
$this->team->telegramNotificationSettings->update(['telegram_enabled' => true]);
|
||||
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeTrue();
|
||||
});
|
||||
|
||||
test('returns true when pushover notifications are enabled', function () {
|
||||
$this->team->pushoverNotificationSettings->update(['pushover_enabled' => true]);
|
||||
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeTrue();
|
||||
});
|
||||
|
||||
test('returns true when webhook notifications are enabled', function () {
|
||||
$this->team->webhookNotificationSettings->update(['webhook_enabled' => true]);
|
||||
|
||||
expect($this->team->isAnyNotificationEnabled())->toBeTrue();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue