Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions .changeset/shaggy-wombats-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/admin.users.v1": patch
"@wso2is/console": patch
---

Improve multiple email addresses and mobile numbers display
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,10 @@ const UserProfileForm: FunctionComponent<UserProfileFormPropsInterface> = ({
typeof email === "object" && email !== null && (email as any).primary === true
)?.value;

if (isMultipleEmailAndMobileNumberEnabled && isEmpty(emailAddresses)) {
if (primaryEmail) {
(
initialValues[systemSchema] as Record<string, unknown>
)[emailAddressesField] = [ primaryEmail ];
}
if (isMultipleEmailAndMobileNumberEnabled && primaryEmail && !emailAddresses.includes(primaryEmail)) {
(
initialValues[systemSchema] as Record<string, unknown>
)[emailAddressesField] = [ primaryEmail, ...emailAddresses ];
}
Comment on lines +246 to 250
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

This initial-values logic for email/mobile lists looks very similar to the shared implementation in @wso2is/common.users.v1/utils/profile-utils (prepareInitialValues/getFlattenedInitialValues). Since this file now has slightly different behavior (inserting the primary value even when the list is non-empty), consider centralizing the behavior in the shared utility (or aligning both) to avoid future drift and inconsistent initialization across screens that rely on the common helper.

Copilot uses AI. Check for mistakes.

if (isMultipleEmailAndMobileNumberEnabled && isEmailVerificationEnabled) {
Expand Down Expand Up @@ -283,12 +281,10 @@ const UserProfileForm: FunctionComponent<UserProfileFormPropsInterface> = ({
(phone as { type: string; value: string }).type === "mobile"
)?.value;

if (isMultipleEmailAndMobileNumberEnabled && isEmpty(mobileNumbers)) {
if (primaryMobile) {
(
initialValues[systemSchema] as Record<string, unknown>
)[mobileNumbersField] = [ primaryMobile ];
}
if (isMultipleEmailAndMobileNumberEnabled && primaryMobile && !mobileNumbers.includes(primaryMobile)) {
(
initialValues[systemSchema] as Record<string, unknown>
)[mobileNumbersField] = [ primaryMobile, ...mobileNumbers ];
}

if (isMultipleEmailAndMobileNumberEnabled && isMobileVerificationEnabled) {
Expand Down
Loading