-
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
[C+ Checklist Needs Completion] [$250] Contact method - Secondary contact method can not select Set as default #46350
Comments
Triggered auto assignment to @greg-schroeder ( |
We think that this bug might be related to #vip-vsp |
@greg-schroeder FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
ProposalPlease re-state the problem that we are trying to solve in this issue.Can't select secondary method as default on a new non-validated account. What is the root cause of that problem?When we have a non-validated account, add a secondary login, and then verify the secondary login, the BE actually sets the secondary login as the primary login. It can be verified from an email received after verifying, telling that the primary login has been changed to the secondary login. So, when we try to set the secondary login as the primary login, the BE responds with a message that the secondary login is already the primary login. What changes do you think we should make in order to solve the problem?If the BE behavior is expected, then we can fix this on the FE. What we want to do is, when validating a secondary login, if the primary login isn't validated yet, set the secondary login as the primary login on success verifying. The loginList will be passed from the function params. Line 368 in 9901ca3
The data that requires update can be seen from the setContactMethodAsDefault optimistic data. (except the login list) |
@greg-schroeder Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Job added to Upwork: https://www.upwork.com/jobs/~012a16b21d55b907d8 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 ( |
Diffdiff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts
index 3019e3dfbb6..ea9fa1e6a60 100644
--- a/src/libs/actions/User.ts
+++ b/src/libs/actions/User.ts
@@ -365,7 +365,7 @@ function validateLogin(accountID: number, validateCode: string) {
/**
* Validates a secondary login / contact method
*/
-function validateSecondaryLogin(contactMethod: string, validateCode: string) {
+function validateSecondaryLogin(contactMethod: string, validateCode: string, loginList: Record<string, Login>) {
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
@@ -444,6 +444,20 @@ function validateSecondaryLogin(contactMethod: string, validateCode: string) {
},
];
+ if (!loginList[currentEmail].validatedDate) {
+ successData.push(
+ ...[
+ {
+ onyxMethod: Onyx.METHOD.MERGE,
+ key: ONYXKEYS.ACCOUNT,
+ value: {
+ primaryLogin: contactMethod,
+ },
+ },
+ ],
+ );
+ }
+
const parameters: ValidateSecondaryLoginParams = {partnerUserID: contactMethod, validateCode};
API.write(WRITE_COMMANDS.VALIDATE_SECONDARY_LOGIN, parameters, {optimisticData, successData, failureData});
diff --git a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.tsx
index 352260c275f..0ed81cddcfb 100644
--- a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.tsx
+++ b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.tsx
@@ -178,8 +178,8 @@ function BaseValidateCodeForm({account = {}, contactMethod, hasMagicCodeBeenSent
}
setFormError({});
- User.validateSecondaryLogin(contactMethod, validateCode);
- }, [validateCode, contactMethod]);
+ User.validateSecondaryLogin(contactMethod, validateCode, loginList);
+ }, [validateCode, contactMethod, loginList]);
return (
<>
|
Oh my bad, the ONYXKEYS.ACCOUNT is duplicated, it should be
This will make sure the secondary login will be the default contact method. I have updated my proposal to fix that. |
Thanks for clarifying! @bernhardoj's updated proposal looks good to me. The RCA is on point and the updated solution fixes the issue in accordance with the Expected result. 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @roryabraham, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@greg-schroeder, @roryabraham, @ikevin127 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
We're currently awaiting Rory's input on the reviewed / selected proposal. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Yes we do! cc @roryabraham for assignment based on #46350 (comment). |
📣 @ikevin127 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
PR is ready cc: @ikevin127 |
ℹ️ Will review on Saturday (PST) when I'll return to office. |
PR merged. Awaiting deploy to staging -> prod |
|
Sure, adjusted |
Payment summary: Contributor: @bernhardoj - $250 - You can make a manual request via ND |
@ikevin127 the automation didn't past the checklist, but can you propose a regression test if one is required here? Thanks! |
Requested in ND. |
@greg-schroeder Thanks for the payment 💯
Regression Test Proposal
Do we agree 👍 or 👎. |
$250 approved for @bernhardoj |
@greg-schroeder @roryabraham @bernhardoj @ikevin127 this issue is now 4 weeks old, please consider:
Thanks! |
Filed regression, payments done. closing |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.13-1
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): [email protected]
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
There should be no error message. Since the secondary contact method becomes primary contact method - Set as default option should not be present
Actual Result:
"This is already your primary contact" error message appears
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6554036_1722022412832.Recording__3615.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ikevin127The text was updated successfully, but these errors were encountered: