-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: Remove GBR from the account settings on initial signup. #49004
Changes from 3 commits
4a5d40b
4d3f3c8
56d75ca
a13cbae
bc8c598
749053a
dcf9a3e
2015a28
32aac08
eb9c7db
42daf68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,16 +40,21 @@ function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps | |
const loginNames = Object.keys(loginList ?? {}); | ||
const navigateBackTo = route?.params?.backTo; | ||
|
||
const filteredLoginNames = loginNames.filter((loginName) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is filter needed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to filter out the temporary validation email to avoid showing the GBR when there is only one contact method. For example, when logging in with a phone number and adding a new contact method, the default contact method is added without the SMS domain. Monosnap.screencast.2024-09-15.17-47-33.mp4There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your detailed explanation! I just asked in another PR whether this behavior is normal. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ntdiary, can you please re-test these, I have made the necessary changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const login = loginList?.[loginName]; | ||
const pendingAction = login?.pendingFields?.deletedLogin ?? login?.pendingFields?.addedLogin ?? undefined; | ||
|
||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
return login?.partnerUserID || pendingAction; | ||
}); | ||
|
||
// Sort the login names by placing the one corresponding to the default contact method as the first item before displaying the contact methods. | ||
// The default contact method is determined by checking against the session email (the current login). | ||
const sortedLoginNames = loginNames.sort((loginName) => (loginList?.[loginName].partnerUserID === session?.email ? -1 : 1)); | ||
|
||
const sortedLoginNames = filteredLoginNames.sort((loginName) => (loginList?.[loginName].partnerUserID === session?.email ? -1 : 1)); | ||
const loginMenuItems = sortedLoginNames.map((loginName) => { | ||
const login = loginList?.[loginName]; | ||
const isDefaultContactMethod = session?.email === login?.partnerUserID; | ||
const pendingAction = login?.pendingFields?.deletedLogin ?? login?.pendingFields?.addedLogin ?? undefined; | ||
if (!login?.partnerUserID && !pendingAction) { | ||
return null; | ||
} | ||
Krishna2323 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let description = ''; | ||
if (session?.email === login?.partnerUserID) { | ||
|
@@ -62,7 +67,9 @@ function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps | |
let indicator; | ||
if (Object.values(login?.errorFields ?? {}).some((errorField) => !isEmptyObject(errorField))) { | ||
indicator = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; | ||
} else if (!login?.validatedDate) { | ||
} else if (!login?.validatedDate && !isDefaultContactMethod) { | ||
indicator = CONST.BRICK_ROAD_INDICATOR_STATUS.INFO; | ||
} else if (!login?.validatedDate && isDefaultContactMethod && sortedLoginNames.length > 1) { | ||
indicator = CONST.BRICK_ROAD_INDICATOR_STATUS.INFO; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the above filter is necessary, then
filteredLoginList
will be an array, soObject.values
isn't needed. :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.