Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEP [TRELLO-2654] Fix email comparison #1755

Merged
merged 1 commit into from
Oct 15, 2024
Merged
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
16 changes: 9 additions & 7 deletions app/utils/EmailAddress.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ case class EmailAddress private (value: String) extends AnyVal {
// Gmail allows to put '.' in the email as a separator. The email is still the same.
// Gmail also allows the '+' trick. We want to bleck all these things
case class EmailAddressSplitted(rawValue: String, rootAddress: String, domain: String) {
def isEquivalentTo(other: String): Boolean = {
val Array(otherAddress, otherDomain) = other.split("@")
if (domain == "gmail.com" && otherDomain == "gmail.com") {
rootAddress == otherAddress.split('+').head.filter(c => c != '.')
} else {
rawValue == other
def isEquivalentTo(other: String): Boolean =
if (other.isBlank) false // Because of RGPD Deletion, emails can be empty
else {
val Array(otherAddress, otherDomain) = other.split("@")
if (domain == "gmail.com" && otherDomain == "gmail.com") {
rootAddress == otherAddress.split('+').head.filter(c => c != '.')
} else {
rawValue == other
}
}
}
}

object EmailAddress {
Expand Down
Loading