diff --git a/src/Email.php b/src/Email.php index cc76b3a..5a79d69 100644 --- a/src/Email.php +++ b/src/Email.php @@ -78,13 +78,9 @@ function send_branch_notification($memberDetails, $config) { $branchEmailMap = get_branch_email_map(); $memberBranch = $memberDetails['branch']; - // If no branch assigned, notify admin + // If no branch assigned, nothing to do — admin already notified at priority 10 if (empty($memberBranch)) { - if (!empty($config['successNotificationEmails'])) { - $intro = "A new member has joined but no branch was assigned.\n\nPlease review and assign a branch manually."; - $emailBody = build_email_body($intro, $memberDetails); - send_notification_emails($config['successNotificationEmails'], 'GMTU Member Registration - No Branch Assigned', $emailBody); - } + log_info("No branch assigned, skipping branch notification (admin already notified)"); return; } diff --git a/tests/EmailTest.php b/tests/EmailTest.php index 04c0526..4d8f39a 100644 --- a/tests/EmailTest.php +++ b/tests/EmailTest.php @@ -191,22 +191,7 @@ public function test_branch_notification_sends_to_branch_email() $this->assertSame('moss-side@tenantsunion.org.uk', $sentTo); } - public function test_branch_notification_notifies_admin_when_no_branch() - { - $sentSubject = null; - Functions\when('wp_mail')->alias(function ($to, $subject) use (&$sentSubject) { - $sentSubject = $subject; - return true; - }); - - send_branch_notification( - $this->makeSampleMemberDetails(['branch' => null]), - $this->makeSampleNotificationConfig() - ); - $this->assertSame('GMTU Member Registration - No Branch Assigned', $sentSubject); - } - - public function test_branch_notification_does_nothing_when_no_branch_and_no_admin() + public function test_branch_notification_does_not_send_when_no_branch() { $mailCalled = false; Functions\when('wp_mail')->alias(function () use (&$mailCalled) { @@ -216,7 +201,7 @@ public function test_branch_notification_does_nothing_when_no_branch_and_no_admi send_branch_notification( $this->makeSampleMemberDetails(['branch' => null]), - $this->makeSampleNotificationConfig(['successNotificationEmails' => []]) + $this->makeSampleNotificationConfig() ); $this->assertFalse($mailCalled); }