Repository navigation
update display name when update legal name #53558
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
Changes from all commits
497c643
3030203
e7e29c8
48b356e
cb9acab
08e1b33
305ecee
72da798
adaf189
e3d78d1
3bb21cd
436c017
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 |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ Onyx.connect({ | |
| key: ONYXKEYS.SESSION, | ||
| callback: (val) => { | ||
| currentUserEmail = val?.email ?? ''; | ||
| currentUserAccountID = val?.accountID ?? -1; | ||
| currentUserAccountID = val?.accountID ?? CONST.DEFAULT_NUMBER_ID; | ||
| }, | ||
| }); | ||
|
|
||
|
|
@@ -121,20 +121,36 @@ function updateDisplayName(firstName: string, lastName: string) { | |
|
|
||
| function updateLegalName(legalFirstName: string, legalLastName: string) { | ||
| const parameters: UpdateLegalNameParams = {legalFirstName, legalLastName}; | ||
|
|
||
| API.write(WRITE_COMMANDS.UPDATE_LEGAL_NAME, parameters, { | ||
| optimisticData: [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, | ||
| value: { | ||
| legalFirstName, | ||
| legalLastName, | ||
| const optimisticData: OnyxUpdate[] = [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, | ||
| value: { | ||
| legalFirstName, | ||
| legalLastName, | ||
| }, | ||
| }, | ||
| ]; | ||
| // In case the user does not have a display name, we will update the display name based on the legal name | ||
| if (!allPersonalDetails?.[currentUserAccountID]?.firstName && !allPersonalDetails?.[currentUserAccountID]?.lastName) { | ||
| optimisticData.push({ | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
| value: { | ||
| [currentUserAccountID]: { | ||
| displayName: PersonalDetailsUtils.createDisplayName(currentUserEmail ?? '', { | ||
| firstName: legalFirstName, | ||
| lastName: legalLastName, | ||
| }), | ||
| }, | ||
| firstName: legalFirstName, | ||
| lastName: legalLastName, | ||
|
Comment on lines
+146
to
+147
Contributor
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. @Themoonalsofall I think it supposed to go inside
Contributor
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. I think we should make a quick follow up PR to fix this
Author
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. Oh, thanks @alitoshmatov. I'll create follow up PR soon.
Author
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. @alitoshmatov follow up PR #56399 |
||
| }, | ||
| ], | ||
| }); | ||
| } | ||
| API.write(WRITE_COMMANDS.UPDATE_LEGAL_NAME, parameters, { | ||
| optimisticData, | ||
| }); | ||
|
|
||
| Navigation.goBack(); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.