Skip to content
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

add “Report virtual card fraud” page and route #28312

Merged
merged 14 commits into from
Oct 10, 2023

Conversation

pasyukevich
Copy link
Contributor

@pasyukevich pasyukevich commented Sep 27, 2023

Details

Fixed Issues

$ #22880

Tests

  • Add useEffect with test data to the InitialSettingsPage
 useEffect(() => {
        window.Onyx.merge(`cardList`, {
            'virtual': {
                cardID: 234523452345,
                state: 3,
                bank: 'Expensify',
                availableSpend:10000,
        domainName: 'Expensify',
        lastFourPAN: '',
        isVirtual: true,
        cardholderFirstName: "Test",
        cardholderLastName: "Test",
            }, 'physical': {
                cardID: 234523452345,
                state: 3,
                bank: '1000',
                availableSpend:10000,
        domainName: 'Expensify',
        lastFourPAN: '2345',
        isVirtual: false,
            },
        });

        Navigation.navigate(ROUTES.getWalletCardRoute('expensify'));
    }, []);
  • Press report fraud
  • Observe redirect to the next page
  • Press deactivate button
  • Verify that no errors appear in the JS console

Offline tests

  • Observe that the 'Deactivate card' button is inactive

QA Steps

  1. Log in with an account that has an active virtual card
  2. Navigate to the wallet page /settings/wallet and wait for all API commands to finish
  3. Navigate directly to /settings/wallet/cards/expensify.com/
  4. Verify the UI looks correct
  5. Tap the "Report virtual card fraud" button
  6. Verify you are redirected to the page to report fraud
  7. Tap "Deactivate card"
  8. Verify that you are redirected back to the Expensify Card page
  9. And a new card should have been issued.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
android.web.webm
Mobile Web - Safari
ios-web.mp4
Desktop
desktop.app.mov
iOS
ios.native.mp4
Android
android.native.webm

@pasyukevich pasyukevich force-pushed the feature/report-fraud branch 4 times, most recently from 1be03aa to 8cbb012 Compare September 27, 2023 11:32
src/pages/settings/Wallet/ReportFraudPage.js Outdated Show resolved Hide resolved
src/pages/settings/Wallet/ReportFraudPage.js Outdated Show resolved Hide resolved
src/pages/settings/Wallet/ReportFraudPage.js Outdated Show resolved Hide resolved
src/libs/actions/Card.js Outdated Show resolved Hide resolved
@pasyukevich pasyukevich force-pushed the feature/report-fraud branch 2 times, most recently from 7533f27 to 1441d4c Compare September 28, 2023 11:13
@pasyukevich pasyukevich marked this pull request as ready for review September 28, 2023 12:41
@pasyukevich pasyukevich requested a review from a team as a code owner September 28, 2023 12:41
@melvin-bot melvin-bot bot requested review from s77rt and removed request for a team September 28, 2023 12:41
@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

@s77rt Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Comment on lines 68 to 72
const submitReportFraud = () => {
Card.reportDigitalExpensifyCardFraud(virtualCard.cardID);
};

const onBackButtonPress = () => Navigation.goBack(ROUTES.SETTINGS_WALLET_DOMAINCARDS.getRoute(domain));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB. Let's inline those functions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, let me know if that's what you meant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to pass the function directly to HeaderWithBackButton

onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WALLET_DOMAINCARDS.getRoute(domain))}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return;
}

FormActions.setErrors(ONYXKEYS.FORMS.REPORT_FRAUD_FORM, virtualCard.errors);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a pattern that we follow. The backend errors are not form errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 the errors should either come from the backend (in that case they are already there on the virtualCard object) or the form itself should set them. In this case though, we have no form fields so there is no validation that could fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically the options are:

  1. Use the FormAlertWithSubmitButton directly (I think this might be the way I would go here) and then pass the errors that are on the card object.
  2. Use the Form - but don't manually set the errors. Just trust that the backend will set them if anything goes wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, so let's go with number 1! What exactly do you mean by "pass the errors that are on the card object."?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I get it now, let me know if that's what you meant 😄 CC: @marcaaron

@s77rt
Copy link
Contributor

s77rt commented Sep 29, 2023

This PR does not seem to be ready for test yet. The backend changes are not live yet, I'm getting 404 errors trying to access /api?command=ReportDigitalExpensifyCardFraud

@pasyukevich
Copy link
Contributor Author

pasyukevich commented Sep 29, 2023

@s77rt I'm not sure that we need to wait BE

@pasyukevich
Copy link
Contributor Author

@marcaaron can you confirm this and take a look at the Error handling?

@grgia grgia self-requested a review September 29, 2023 09:22
@JKobrynski
Copy link
Contributor

I am not the owner of this PR, so I can't edit the description, but I think the useEffect step described above won't work anymore, what worked for me was this:

useEffect(() => {
    window.Onyx.merge(`cardList`, {
        'virtual': {
            cardID: 234523452345,
            state: 3,
            bank: 'Expensify',
            availableSpend:10000,
    domainName: 'Expensify',
    lastFourPAN: '',
    isVirtual: true,
    cardholderFirstName: "Test",
    cardholderLastName: "Test",
        }, 'physical': {
            cardID: 234523452345,
            state: 3,
            bank: '1000',
            availableSpend:10000,
    domainName: 'Expensify',
    lastFourPAN: '2345',
    isVirtual: false,
        },
    });

    Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAINCARDS.getRoute('expensify'));
}, []);

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is looking great. I don't have many comments, but will ask for some annoying name changes.

@@ -141,6 +141,7 @@ const SettingsModalStackNavigator = createModalStackNavigator({
Settings_Lounge_Access: () => require('../../../pages/settings/Profile/LoungeAccessPage').default,
Settings_Wallet: () => require('../../../pages/settings/Wallet/WalletPage').default,
Settings_Wallet_DomainCards: () => require('../../../pages/settings/Wallet/ExpensifyCardPage').default,
Settings_Report_Fraud: () => require('../../../pages/settings/Wallet/ReportFraudPage').default,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this Settings_Wallet_ReportVirtualCardFraud for consistency?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done!

/**
* @param {Number} cardID
*/
function reportDigitalExpensifyCardFraud(cardID) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, we decided to rebrand these as "virtual cards". Could we update that for consistency? So...

  • reportDigitalExpensifyCardFraud -> reportVirtualExpensifyCardFraud
  • ReportDigitalExpensifyCardFraud -> ReportVirtualExpensifyCardFraud
  • report-digital-fraud -> report-virtual-fraud
  • etc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

src/ONYXKEYS.ts Outdated
@@ -291,6 +291,7 @@ const ONYXKEYS = {
PRIVATE_NOTES_FORM: 'privateNotesForm',
I_KNOW_A_TEACHER_FORM: 'iKnowTeacherForm',
INTRO_SCHOOL_PRINCIPAL_FORM: 'introSchoolPrincipalForm',
REPORT_FRAUD_FORM: 'reportFraudForm',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also could make this: REPORT_VIRTUAL_CARD_FRAUD? Not sure if we will have other kinds of fraud reporting, but doesn't hurt to get specific here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

return;
}

FormActions.setErrors(ONYXKEYS.FORMS.REPORT_FRAUD_FORM, virtualCard.errors);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 the errors should either come from the backend (in that case they are already there on the virtualCard object) or the form itself should set them. In this case though, we have no form fields so there is no validation that could fail.

@marcaaron
Copy link
Contributor

btw tested locally with a real virtual card and it's looking nice..

2023-10-03_14-34-58 2023-10-03_14-47-50

@s77rt
Copy link
Contributor

s77rt commented Oct 4, 2023

I'm not sure I can test this well. Request to /api?command=ReportDigitalExpensifyCardFraud fail with 404 and is stuck in persisted requests. Don't we need to wait for backend first? cc @marcaaron

@JKobrynski
Copy link
Contributor

I pushed a couple commits, I think all comments have been addressed in some way, let me know if there is anything else you'd like me to change!

CC: @marcaaron @s77rt

@JKobrynski JKobrynski mentioned this pull request Oct 6, 2023
59 tasks
@JKobrynski
Copy link
Contributor

PR updated

CC: @marcaaron @s77rt

@marcaaron
Copy link
Contributor

marcaaron commented Oct 6, 2023

@marcaaron I can initiate the deactivate card request (after setting Onyx as in the PR description). But once I do (and click the submit button), all I would see is an infinite loader due to the request not getting completed.

@s77rt Test what you can. Like I said, I will verify that part.

@s77rt
Copy link
Contributor

s77rt commented Oct 7, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
mweb-chrome.mov
Mobile Web - Safari
mweb-safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov

@marcaaron marcaaron added the InternalQA This pull request required internal QA label Oct 10, 2023
@marcaaron
Copy link
Contributor

I think this one looks ready to merge now. As for testing... this isn't something that QA will be able to test as the flows aren't really accessible and I am not sure if they have Expensify Cards.

I updated the test steps and I think either myself or @grgia should be able to do them on staging.

@marcaaron marcaaron self-requested a review October 10, 2023 23:30
@marcaaron marcaaron merged commit cb883e8 into Expensify:main Oct 10, 2023
12 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/marcaaron in version: 1.3.81-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@marcaaron
Copy link
Contributor

This pretty much failed the internal QA for me, but since this flow isn't really "accessible" yet I think we can deploy anyway and continue testing as we go and create some follow up issues. We will want to E2E test everything before we release the changes to the wallet page.

cc @grgia but this is what I ran into:

  1. Able to access the Expensify card page
  2. Navigating to the report virtual card page works
  3. Request to deactivate the card
  4. Doesn't work and fails with these weird things
2023-10-11_13-42-53

Expired physical card case

First interesting thing is that it says I have no physical card. This is correct, mine has expired 😅

2023-10-11_13-47-44

@kevinksullivan @joekaufmanexpensify what should the behavior be in this case?

Error message says MISSING TRANSLATION

This comes from here. So it means we are taking the error message and assuming it is a translation key. Maybe something with this logic is off @fedirjh. Because it would not throw on staging if I am looking at it correctly 🤔

function translateIfPhraseKey(message) {
if (_.isEmpty(message)) {
return '';
}
try {
// check if error message has a variable parameter
const [phrase, variables] = _.isArray(message) ? message : [message];
// This condition checks if the error is already translated. For example, if there are multiple errors per input, we handle translation in ErrorUtils.addErrorMessage due to the inability to concatenate error keys.
if (variables && variables.isTranslated) {
return phrase;
}
return translateLocal(phrase, variables);
} catch (error) {
return message;
}
}

I think on production this error would end up showing to the user Auth RequestReplacementExpensifyCard returned an error which we probably don't want.

But what do we want to say here? cc @kevinksullivan & @joekaufmanexpensify again here as it probably depends on what we decide on first issue.

Separately, maybe someone with a physical + virtual card is daring enough to try this on NewDot staging?

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/marcaaron in version: 1.3.83-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@fedirjh
Copy link
Contributor

fedirjh commented Oct 12, 2023

Because it would not throw on staging if I am looking at it correctly

@marcaaron I believe this is a regression from #28377, which appears to have altered the error-handling mechanism previously in use.

I think on production this error would end up showing to the user Auth RequestReplacementExpensifyCard returned an error which we probably don't want.

I expect that production will behave similarly to staging and also display MISSING TRANSLATION.

I think prior to that PR it will display the server error: Auth RequestReplacementExpensifyCard returned an error which we probably don't want.

@marcaaron
Copy link
Contributor

I expect that production will behave similarly to staging and also display MISSING TRANSLATION.

Hmm ok I am not really sure what the expected behavior is supposed to be here. Pretty confused on those changes overall actually. Maybe @mountiny can explain what we should do.

@mountiny
Copy link
Contributor

This is bug in the form error, we are passing the message which wants to be translated into translate method which we should not be doing. That will be handled as a fix of the form component, dont have link right now, sorry

@marcaaron
Copy link
Contributor

ah so all error messages from the backend that the Form component was previously displaying are broken atm?

@mountiny
Copy link
Contributor

ah so all error messages from the backend that the Form component was previously displaying are broken atm?

If they are being passed as what should be a translate key to translate method, then yeah, this feels like incorrect usage of the translate utility.

If we want to keep this behaviour in Form, ie get translated error if the key exist.

Other option which I dont think we really want to do now, would be to catch the error in PHP and then pass down the translation key and have a nice and translated error.

@mountiny
Copy link
Contributor

This was added as a futureproof concept for violations, which will be passed from a server and should be translated so the MISSING TRANSLATIONS is shown Only to Expensify emails account https://github.com/Expensify/App/pull/28377/files#diff-2f79c1e80b9fe28f0d8f5487095f8219dce80539b231f41190e509b8d5d3f8d4R93

So cutomers should still just see the Error from the server @marcaaron

@marcaaron
Copy link
Contributor

Interesting. I missed that convo. Still not sure what it means. So if someone with an "expensify email" sees the MISSING TRANSLATIONS then they should do what exactly? 😅

@mountiny
Copy link
Contributor

It should just be easier to spot that there is a bug and raise it as a bug 😄 we did not really expect this would be happening until violations come in wave9 but the current usage of the form validation error does not look ideal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InternalQA This pull request required internal QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants