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

Merge spencer/eng-2208/user-phoneNumber #52

Merged
merged 2 commits into from
Jan 28, 2025
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
10 changes: 7 additions & 3 deletions src/main/java/io/fusionauth/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public class User extends SecureIdentity implements Buildable<User>, Tenantable

public String parentEmail;

public String phoneNumber;

public UUID tenantId;

public ZoneId timezone;
Expand Down Expand Up @@ -122,6 +124,7 @@ public User(User other) {
this.passwordChangeReason = other.passwordChangeReason;
this.passwordChangeRequired = other.passwordChangeRequired;
this.passwordLastUpdateInstant = other.passwordLastUpdateInstant;
this.phoneNumber = other.phoneNumber;
this.preferredLanguages.addAll(other.preferredLanguages);
this.registrations.addAll(other.registrations.stream().map(UserRegistration::new).collect(Collectors.toCollection(ArrayList::new)));
this.salt = other.salt;
Expand Down Expand Up @@ -181,6 +184,7 @@ public boolean equals(Object o) {
Objects.equals(middleName, user.middleName) &&
Objects.equals(mobilePhone, user.mobilePhone) &&
Objects.equals(parentEmail, user.parentEmail) &&
Objects.equals(phoneNumber, user.phoneNumber) &&
Objects.equals(twoFactor, user.twoFactor) &&
Objects.equals(tenantId, user.tenantId) &&
Objects.equals(timezone, user.timezone);
Expand Down Expand Up @@ -273,8 +277,7 @@ public boolean hasUserData() {
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), preferredLanguages, memberships, registrations, active, birthDate, cleanSpeakId, data,
email,
expiry, firstName, fullName, imageUrl, insertInstant, lastName, lastUpdateInstant, middleName, mobilePhone, parentEmail, tenantId, timezone, twoFactor);
email, expiry, firstName, fullName, imageUrl, insertInstant, lastName, lastUpdateInstant, middleName, mobilePhone, parentEmail, phoneNumber, tenantId, timezone, twoFactor);
}

/**
Expand Down Expand Up @@ -322,6 +325,7 @@ public void normalize() {
middleName = trim(middleName);
mobilePhone = trim(mobilePhone);
parentEmail = toLowerCase(trim(parentEmail));
phoneNumber = trimToNull(phoneNumber);
Normalizer.removeEmpty(preferredLanguages);
Normalizer.deDuplicate(preferredLanguages);
preferredLanguages.removeIf(l -> l.toString().equals(""));
Expand Down Expand Up @@ -485,7 +489,7 @@ public User sort() {
ZonedDateTime now = ZonedDateTime.now();
this.identities.sort(Comparator.<UserIdentity, ZonedDateTime>comparing(i -> Optional.ofNullable(i.insertInstant)
// if we don't have one, assuming it's about
// to be inserted, which would put at the the 'bottom'
// to be inserted, which would put it at the 'bottom'
// of the list, is sensible
.orElse(now))
.thenComparing(i -> i.type)
Expand Down