Skip to content

[FIX] website_membership_registration: Added active and case insensitive checks for mail_uniqueness#140

Merged
ByteMeAsap merged 1 commit into
18.0from
18.0-fix-website_membership_registration
Apr 30, 2026
Merged

[FIX] website_membership_registration: Added active and case insensitive checks for mail_uniqueness#140
ByteMeAsap merged 1 commit into
18.0from
18.0-fix-website_membership_registration

Conversation

@ByteMeAsap
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 30, 2026 10:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the member email uniqueness constraint in website_membership_registration to avoid false matches and to only consider active member records when checking for duplicates.

Changes:

  • Switches the duplicate-email SQL check from ILIKE pattern matching to case-insensitive equality via LOWER(email) = LOWER(%s).
  • Restricts the duplicate-email check to active partners (active = TRUE).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +81 to +84
WHERE LOWER(email) = LOWER(%s)
AND id != %s
AND membership_state != 'none'
AND active = TRUE
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

The SQL now filters duplicates to active = TRUE, but the constraint is only declared on email and membership_state. If a user archives/unarchives a partner (toggles active), this constraint won't run, which can allow creating two active members with the same email after reactivation. Include active in the @api.constrains(...) fields (or enforce uniqueness regardless of active) so activation changes also trigger the check.

Copilot uses AI. Check for mistakes.
@ByteMeAsap ByteMeAsap force-pushed the 18.0-fix-website_membership_registration branch from a2db998 to e80f75c Compare April 30, 2026 10:59
@ByteMeAsap ByteMeAsap merged commit 1ae95e4 into 18.0 Apr 30, 2026
1 of 3 checks passed
@ByteMeAsap ByteMeAsap deleted the 18.0-fix-website_membership_registration branch April 30, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants