Closed lanitochka17 closed 1 month ago
Triggered auto assignment to @grgia (DeployBlockerCash
), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.
:wave: Friendly reminder that deploy blockers are time-sensitive โฑ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
@grgia 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
Job added to Upwork: https://www.upwork.com/jobs/~0107ec935581e086f0
Triggered auto assignment to Contributor-plus team member for initial proposal review - @allroundexperts (External
)
Marking as external so we might get help from contributors sooner
Proposal to Fix the Issue: "Contact Method - Magic Code Doesn't Arrive Unless User Requests Again"
Problem Description: When a new user logs into the staging environment and navigates to profile settings to add a contact method, the magic code intended for verification does not arrive in their email unless the user manually clicks "Didn't receive a magic code?".
Steps to Reproduce:
Expected Result: The magic code should be automatically sent to the user's email without requiring the user to click "Didn't receive a magic code?".
The magic code is only sent after the user clicks "Didn't receive a magic code?".
Identify the Function Responsible for Sending the Magic Code:
Review and Modify the Trigger Mechanism:
Implement Automatic Dispatch of the Magic Code:
Current Implementation:
// Function triggered by button click
const resendMagicCode = () => {
// Logic to send the magic code
};
Proposed Implementation:
useEffect(() => {
// Automatically send the magic code when the component mounts
sendMagicCode();
}, []);
const sendMagicCode = () => {
// Logic to send the magic code
};
Ensure Robust State Management:
I came across this project on Upwork and would like to offer the above solution. I have outlined a technical explanation to address this issue as mentioned.
I can't wait to dive into this amazing project and see how I can help out with other tasks too.
Looking forward to making a positive impact! Regards.
๐ฃ @TheGithubDev! ๐ฃ Hey, it seems we donโt have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: thecoolrayyan@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~0184d64a438e2e09d2
โ Contributor details stored successfully. Thank you for contributing to Expensify!
I wasn't able to reproduce this in staging. Adding a new contact method sent me the email.
Gonna demote to NAB
@lanitochka17 Is this still happening? Seems to be fixed for me as well.
Issue is still reproducible
https://github.com/Expensify/App/assets/78819774/93e2a4ca-8f00-49aa-8c26-2757af1f0d3b
๐ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐ธ
@allroundexperts, @grgia Huh... This is 4 days overdue. Who can take care of this?
@lanitochka17 is this still occurring on staging?
Closing for now as I cannot reproduce
Issue is still reproducible on the latest build 9.0.23-0
https://github.com/user-attachments/assets/07120aa2-f4c2-4e98-81ec-3a283c2878bf
Edited by proposal-police: This proposal was edited at 2023-10-02T14:22:00Z.
Magic code will not be sent unless the user requests it again.
We are not sending any request code unless it's manually pressed
Modify this useEffect to call User.requestContactMethodValidateCode
when validatedDate
empty and validateCodeSent
is false.
src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx
useEffect(() => {
if (isEmptyObject(loginData)) {
return;
}
User.resetContactMethodValidateCodeSentState(contactMethod);
// initialCodeValidateRequestedRef is required to prevent duplicate calls in React strict mode
if (!loginData?.validatedDate && !loginData?.validateCodeSent && !initialCodeValidateRequestedRef.current) {
User.requestContactMethodValidateCode(contactMethod);
initialCodeValidateRequestedRef.current = true;
return;
}
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);
To prevent the "linkHasBeenResent" text from appearing on the initial page load, we can add a new state called "validateCodeSentIsPressed" to display the message only after the resent link has been pressed at least once.
src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.tsx
<Text style={[StyleUtils.getDisabledLinkStyles(shouldDisableResendValidateCode)]}>{translate('validateCodeForm.magicCodeNotReceived')}</Text>
</PressableWithFeedback>
{hasMagicCodeBeenSent && validateCodeSentIsPressed && (
<DotIndicatorMessage
type="success"
style={[styles.mt6, styles.flex0]}
If we want to keep the user to trigger the validationCode manually, we can add new screen that contain the send validation button or at least change Didn't receive a magic code?
to something Send magic code
and replace the text to Didn't receive a magic code?
when the button pressed at least once
Call requestContactMethodValidateCode when we navigate to ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute
src/components/ValidateAccountMessage.tsx
<TextLink
fontSize={variables.fontSizeLabel}
onPress={() => {
const loginName = loginNames?.[0]
const login = loginList?.[loginName] ?? {};
if (!login?.validatedDate && !login?.validateCodeSent) {
User.requestContactMethodValidateCode(loginName);
}
src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx
<MenuItem
title={menuItemTitle}
description={description}
onPress={() => {
const login = loginList?.[loginName] ?? {};
if (!login?.validatedDate && !login?.validateCodeSent) {
User.requestContactMethodValidateCode(loginName);
}
Ensure re-sent message only shown when pressed at least once src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.tsx
const [validateCodeSentIsPressed, setValidateCodeSentIsPressed] = useState(false);
...
const resendValidateCode = () => {
User.requestContactMethodValidateCode(contactMethod);
inputValidateCodeRef.current?.clear();
setValidateCodeSentIsPressed(true);
};
...
{hasMagicCodeBeenSent && validateCodeSentIsPressed && (
<DotIndicatorMessage
type="success"
๐ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐ธ
@wildan-m's proposal looks good to me. The RCA is straightforward, and the solution makes sense as well.
๐ ๐ ๐ C+ reviewed
Triggered auto assignment to @mountiny, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@allroundexperts @wildan-m Why can we not make the api request when user clicks the button that navigates them? it feels like a better spot for this api call than the useEffect. But both work
๐ฃ @wildan-m ๐ An offer has been automatically sent to your Upwork account for the Contributor role ๐ Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review ๐งโ๐ป Keep in mind: Code of Conduct | Contributing ๐
@mountiny I think that's better approach. We don't need to handle useEffect strict mode with that approach.
My proposal updated I've added it as my 2nd alternative
@allroundexperts I will create the PR with that solution. Let me know if we still want to use the useEffect approach.
@allroundexperts The PR is ready for review. https://github.com/Expensify/App/pull/48047
This issue has not been updated in over 15 days. @wildan-m, @allroundexperts, @mountiny, @grgia eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
$250 to @wildan-m and to @allroundexperts
Triggered auto assignment to @greg-schroeder (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.
cc @greg-schroeder
Payment summary:
Contributor: @wildan-m - $250 - will be paid via Upwork on 9/25 C+: @allroundexperts - $250 - can make a manual request via ND on 9/25
@wildan-m, @greg-schroeder, @allroundexperts, @mountiny, @grgia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
This isn't overdue
@wildan-m @allroundexperts have you been paid? Can we close?
I have noted it down. We can close it out.
@mountiny not yet
Well, payment date is today, so I'm doing it now. :)
Paid
$250 approved for @allroundexperts
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: 1.4.81-1 Reproducible in staging?: Y Reproducible in production?: N 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): berhanesarah.testing+ftu@gmail.com Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Magic code is sent to the email
Actual Result:
Magic code is not sent to the email unless the user clicks "Didn't receive a magic code?"
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/1c0ede88-1b11-4337-9c35-90ff0eab2fcc
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @allroundexperts