Closed lanitochka17 closed 3 weeks ago
Triggered auto assignment to @OfstadC (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Edited by proposal-police: This proposal was edited at 2023-10-06T15:45:00Z.
When adding a new contact method (email), if the user enters an incorrect Magic code during the email verification step, no clear error message is displayed. Instead, the user is redirected to the next page without being informed that the Magic code was wrong. The expected behavior is to show a clear error message and prevent the user from moving forward.
As we are using addNewContactMethod action in the NewContactMethodPage:
As a result, the error object remains empty, and the user is redirected without seeing the error.
Modify the error message in the addNewContactMethod function:
Update this line: here
to
ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('contacts.genericFailureMessages.validateSecondaryLogin')
if there is an error don't allow user to go to the next page,
add this check:
if(validateLoginError) return;
here:
https://github.com/Expensify/App/blob/e4969b22e7dbb1f6a200cc587ced4ab665415c0e/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx#L58
as:
const addNewContactMethod = useCallback(
(magicCode: string) => {
User.addNewContactMethod(pendingContactAction?.contactMethod ?? '', magicCode);
if(validateLoginError) return;
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.route);
},
[pendingContactAction?.contactMethod],
);
wrap this clearError function in the useCallback: https://github.com/Expensify/App/blob/2d9a28ff3e56f449b9bfce0bb1cec5c3e0cb91c2/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx#L150
https://github.com/user-attachments/assets/5d24a3c1-8103-4a48-b107-57b6f26048ed
Testing now
Job added to Upwork: https://www.upwork.com/jobs/~021846210499801072215
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale (External
)
The error message that says "Failed to add the contact method" will be shown, but the exact error will not be visible to the user
We always navigate back to the list contact method page after we submit the magic code
Another problem here is we added the addedLogin
error and pending field here and here
But we get the error with validateLogin
here
We should only navigate back to the list contact method page if we enter the correct magic code.
callback
in addNewContactMethod
function and call the callback after the API is completefunction addNewContactMethod(contactMethod: string, validateCode = '', callback = () => {}) {
...
API.write(WRITE_COMMANDS.ADD_NEW_CONTACT_METHOD, parameters, {optimisticData, successData, failureData}).then(callback);
callback
param to addNewContactMethod
function and only navigate back if we don't have any errorconst addNewContactMethod = useCallback(
(magicCode: string) => {
User.addNewContactMethod(pendingContactAction?.contactMethod ?? '', magicCode, () => {
if (Object.values(validateLoginError).length) {
return;
}
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.route);
});
},
[pendingContactAction?.contactMethod, validateLoginError],
);
addedLogin
field here or we can change the field in addNewContactMethod
to validateLogin
For points 1 and 2 we can return the promise in addNewContactMethod
and do the navigate logic in this promise
@akinwale Could you review the proposals by Monday? Thank you! 😃
Since refactoring is currently taking place on the same files and they are implementing a different modal, I suggest we hold off on this issue until those changes are completed. PR
Yes, @OfstadC please hold this one for https://github.com/Expensify/App/pull/49445, we fixed this issue there
@hungvu193 - looks like https://github.com/Expensify/App/pull/49445 has been deployed. Do we need to do anything else for this issue? Or does that cover this fix?
Verified it's fixed on Staging. We can close this issue 😄
https://github.com/user-attachments/assets/b2f936ed-668a-4570-98e8-fc52f4b46024
Thank youuu!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.48 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): Yokabdk+new223@gmail.com Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
An incorrect magic code sign is shown, allowing the user to easily identify the error and edit the magic code
Actual Result:
The error message that says "Failed to add the contact method" will be shown, but the exact error will not be visible to the user
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/df5b93fe-5c64-4279-8016-21841f7c3c25
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @akinwale