Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/code/core/Mage/Newsletter/Model/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,14 @@ public function subscribe($email)

$this->setSubscriberEmail($email);
} elseif ($this->getStatus() == self::STATUS_SUBSCRIBED) {
Mage::throwException(Mage::helper('newsletter')->__('This email address is already registered.'));
// Allow resubscription if user is subscribing their own email
if (!$isSubscribeOwnEmail) {
Mage::throwException(Mage::helper('newsletter')->__('This email address is already registered.'));
}

// User is resubscribing their own email that's already subscribed
// Return early to avoid unnecessary save() and duplicate confirmation emails
return $this->getStatus();
Comment on lines +358 to +365
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new behavior that allows logged-in users to resubscribe their own email without throwing an exception is not covered by tests. The existing cypress test at cypress/e2e/openmage/frontend/homepage/newsletter.cy.js only tests guest subscription scenarios. Consider adding a test case that verifies a logged-in user can resubscribe their own email without errors.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@sreichel sreichel Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add test to cypress/e2e/openmage/frontend/customer/account.cy.js

}

if ($isSubscribeOwnEmail) {
Expand Down
Loading