Skip to content

A free open source IT asset/license management system

Remove admin_cc_email validation for admin_cc_always

Marcus Moore088e6af0b5cd
diff --git a/app/Http/Requests/StoreNotificationSettings.php b/app/Http/Requests/StoreNotificationSettings.php
index 6b2b1f5aec..f58d014c76 100644
--- a/app/Http/Requests/StoreNotificationSettings.php
+++ b/app/Http/Requests/StoreNotificationSettings.php
@@ -26,11 +26,7 @@ class StoreNotificationSettings extends FormRequest
{
return [
'alert_email' => 'email_array|nullable',
- 'admin_cc_email' => [
- 'email_array',
- 'nullable',
- 'required_if_accepted:admin_cc_always',
- ],
+ 'admin_cc_email' => 'email_array|nullable',
'admin_cc_always' => [
Rule::in('0', '1'),
],
diff --git a/tests/Feature/Settings/AlertsSettingTest.php b/tests/Feature/Settings/AlertsSettingTest.php
index 7812d0eb33..f8829d3825 100644
--- a/tests/Feature/Settings/AlertsSettingTest.php
+++ b/tests/Feature/Settings/AlertsSettingTest.php
@@ -39,15 +39,6 @@ class AlertsSettingTest extends TestCase
$this->assertDatabaseHas('settings', ['admin_cc_always' => '1']);
}
- public function test_cannot_update_admin_cc_always_without_admin_cc_email()
- {
- $this->settings->disableAdminCCAlways();
-
- $this->actingAs(User::factory()->superuser()->create())
- ->post(route('settings.alerts.save', ['admin_cc_always' => '1']))
- ->assertSessionHasErrors('admin_cc_always');
- }
-
public function test_can_update_admin_cc_always_to_false()
{
$this->settings->enableAdminCC()->enableAdminCCAlways();
diff --git a/tests/Support/Settings.php b/tests/Support/Settings.php
index d33970e683..8ff8ba6945 100644
--- a/tests/Support/Settings.php
+++ b/tests/Support/Settings.php
@@ -4,7 +4,6 @@ namespace Tests\Support;
use App\Models\Setting;
use Illuminate\Support\Facades\Crypt;
-use RuntimeException;
class Settings
{
@@ -63,10 +62,6 @@ class Settings
public function enableAdminCCAlways(): Settings
{
- if (is_null($this->setting->admin_cc_email) || $this->setting->admin_cc_email == 0) {
- throw new RuntimeException('admin_cc_email requires admin_cc_email to be set.');
- }
-
return $this->update([
'admin_cc_always' => 1,
]);