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

[HOLD for payment 2023-08-16][$1000] Attachment ValidationModal texts are not translated to Spanish #22665

Closed
1 of 6 tasks
kavimuru opened this issue Jul 11, 2023 · 44 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jul 11, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Login in 2 tabs.
  2. From the first tab, drag a large video into composer ( > 24MB), the ValidationModal will be showed.
  3. From second tab, change language to Spanish.
  4. Now go back to the first tab. Notice that ValidationModal 's texts are not translated to Spanish.

Expected Result:

Modal text (title, prompt) should be translated to Spanish.

Actual Result:

Modal texts (title, prompt) aren't translated to Spanish.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.39-5
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-07-10.at.23.32.37.mov
Recording.1241.mp4

Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1689006789754909

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01af42706e42700678
  • Upwork Job ID: 1682145330266705920
  • 2023-07-20
  • Automatic offers:
    • hungvu193 | Contributor | 25841031
    • hungvu193 | Reporter | 25841033
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2023

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@kavimuru
Copy link
Author

Proposal

by @hungvu193

Please re-state the problem that we are trying to solve in this issue.

Attachment Validation Modal's texts are not translated to Spanish

What is the root cause of that problem?

We're setting text as title and prompt for the ConfirmModal in here:

(_file) => {
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(_file, 'name', ''));
if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
const invalidReason = props.translate('attachmentPicker.notAllowedExtension');
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle(props.translate('attachmentPicker.wrongFileType'));
setAttachmentInvalidReason(invalidReason);
return false;
}
if (lodashGet(_file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle(props.translate('attachmentPicker.attachmentTooLarge'));
setAttachmentInvalidReason(props.translate('attachmentPicker.sizeExceeded'));
return false;
}
if (lodashGet(_file, 'size', 0) < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle(props.translate('attachmentPicker.attachmentTooSmall'));
setAttachmentInvalidReason(props.translate('attachmentPicker.sizeNotMet'));
return false;
}

<ConfirmModal
title={attachmentInvalidReasonTitle}
onConfirm={closeConfirmModal}
onCancel={closeConfirmModal}
isVisible={isAttachmentInvalid}
prompt={attachmentInvalidReason}
confirmText={props.translate('common.close')}
shouldShowCancelButton={false}
/>

That's why when we changed the language, only Close button text was translated.

What changes do you think we should make in order to solve the problem?

We should get rid of text, since it's required re-render to make it translated. We should use translate key instead.
So we need to update our isValidFile function to use translate key:

            if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
                const invalidReason = 'attachmentPicker.notAllowedExtension';
                setAttachmentInvalidReasonTitle('attachmentPicker.wrongFileType');
                setAttachmentInvalidReason(invalidReason);
                setIsAttachmentInvalid(true);
                return false;
            }

            if (lodashGet(_file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
                setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooLarge');
                setAttachmentInvalidReason('attachmentPicker.sizeExceeded');
                setIsAttachmentInvalid(true);
                return false;
            }

            if (lodashGet(_file, 'size', 0) < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
                setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooSmall');
                setAttachmentInvalidReason('attachmentPicker.sizeNotMet');
                setIsAttachmentInvalid(true);
                return false;
            }

And finally update the title and prompt to use props.translate

            <ConfirmModal
               // we should use safe check here to prevent crash because of missing translate key
                title={!!attachmentInvalidReasonTitle ? props.translate(attachmentInvalidReasonTitle) : ''}
                onConfirm={closeConfirmModal}
                onCancel={closeConfirmModal}
                isVisible={isAttachmentInvalid}
                prompt={!!attachmentInvalidReason ? props.translate(attachmentInvalidReason) : ''}
                confirmText={props.translate('common.close')}
                shouldShowCancelButton={false}
            />

What alternative solutions did you explore? (Optional)

N/A

Result

Screen.Recording.2023-07-10.at.23.28.54.mov

@adelekennedy
Copy link

posted in Slack I don't see this as a user problem, it's edge case behavior

@hungvu193
Copy link
Contributor

hungvu193 commented Jul 12, 2023

@adelekennedy I think it's actually bug since we set text for the modal instead of "translateKey", we should avoid using that.
I also believe we fixed other similar bugs before.

@adelekennedy
Copy link

hmm @hungvu193 it sounds like this is something you think we should fix overall that's leading to related bugs (these are all very edge case behaviors - but I can see an argument for opening one issue to fix them all)

@hungvu193
Copy link
Contributor

hungvu193 commented Jul 17, 2023

@adelekennedy Yep, we should fix them all, I found into our project and there're 2 places (one in this issue you mentioned) and one with TaskAssigneePage.
We need to get rid of translateText, we should use translateKey. The solution in my proposal can fix for other places too.

@hungvu193
Copy link
Contributor

hungvu193 commented Jul 20, 2023

Updated my proposal to address issue from AvatarWithImagePicker as well since they had the same RCA

Proposal

Please re-state the problem that we are trying to solve in this issue.

Attachment Validation Modal's texts are not translated to Spanish

What is the root cause of that problem?

We're setting text as title and prompt for the ConfirmModal in here:

(_file) => {
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(_file, 'name', ''));
if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
const invalidReason = props.translate('attachmentPicker.notAllowedExtension');
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle(props.translate('attachmentPicker.wrongFileType'));
setAttachmentInvalidReason(invalidReason);
return false;
}
if (lodashGet(_file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle(props.translate('attachmentPicker.attachmentTooLarge'));
setAttachmentInvalidReason(props.translate('attachmentPicker.sizeExceeded'));
return false;
}
if (lodashGet(_file, 'size', 0) < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle(props.translate('attachmentPicker.attachmentTooSmall'));
setAttachmentInvalidReason(props.translate('attachmentPicker.sizeNotMet'));
return false;
}

<ConfirmModal
title={attachmentInvalidReasonTitle}
onConfirm={closeConfirmModal}
onCancel={closeConfirmModal}
isVisible={isAttachmentInvalid}
prompt={attachmentInvalidReason}
confirmText={props.translate('common.close')}
shouldShowCancelButton={false}
/>

That's why when we changed the language, only Close button text was translated.

What changes do you think we should make in order to solve the problem?

We should get rid of text, since it's required re-render to make it translated. We should use translate key instead.
So we need to update our isValidFile function to use translate key:

            if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
                const invalidReason = 'attachmentPicker.notAllowedExtension';
                setAttachmentInvalidReasonTitle('attachmentPicker.wrongFileType');
                setAttachmentInvalidReason(invalidReason);
                setIsAttachmentInvalid(true);
                return false;
            }

            if (lodashGet(_file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
                setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooLarge');
                setAttachmentInvalidReason('attachmentPicker.sizeExceeded');
                setIsAttachmentInvalid(true);
                return false;
            }

            if (lodashGet(_file, 'size', 0) < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
                setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooSmall');
                setAttachmentInvalidReason('attachmentPicker.sizeNotMet');
                setIsAttachmentInvalid(true);
                return false;
            }

And finally update the title and prompt to use props.translate

            <ConfirmModal
               // we should use safe check here to prevent crash because of missing translate key
                title={!!attachmentInvalidReasonTitle ? props.translate(attachmentInvalidReasonTitle) : ''}
                onConfirm={closeConfirmModal}
                onCancel={closeConfirmModal}
                isVisible={isAttachmentInvalid}
                prompt={!!attachmentInvalidReason ? props.translate(attachmentInvalidReason) : ''}
                confirmText={props.translate('common.close')}
                shouldShowCancelButton={false}
            />

I also found out that we are using it in our AvatarWithImagePicker, we can fix it similar the way above by using translateKey instead of text.
We should replace usage of this.props.translate from our showErrorModal function and replace it with translateKey. Finally update the ConfirmModal to use translateKey

<ConfirmModal
    title={this.state.errorModalTitle ? this.props.translate(this.state.errorModalTitle) : ''}
    onConfirm={this.hideErrorModal}
    onCancel={this.hideErrorModal}
    isVisible={this.state.isErrorModalVisible}
    prompt={this.state.errorModalPrompt ? this.props.translate(this.state.errorModalPrompt) : ''}
    confirmText={this.props.translate('common.close')}
    shouldShowCancelButton={false}
/>

Overall, they had same RCA, so we can address any issue related to this one in here.

What alternative solutions did you explore? (Optional)

N/A

Result

Screen.Recording.2023-07-10.at.23.28.54.mov

@melvin-bot melvin-bot bot added the Overdue label Jul 20, 2023
@adelekennedy
Copy link

Okay! Let's keep this open and close the issues that are coming back to the same root issue

@melvin-bot melvin-bot bot removed the Overdue label Jul 20, 2023
@adelekennedy adelekennedy added External Added to denote the issue can be worked on by a contributor Overdue labels Jul 20, 2023
@melvin-bot melvin-bot bot changed the title Attachment ValidationModal texts are not translated to Spanish [$1000] Attachment ValidationModal texts are not translated to Spanish Jul 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01af42706e42700678

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

Current assignee @adelekennedy is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External)

@adelekennedy
Copy link

not overdue melvin

@melvin-bot melvin-bot bot removed the Overdue label Jul 20, 2023
@Santhosh-Sellavel
Copy link
Collaborator

@hungvu193 Any Idea where was this broken?

@hungvu193
Copy link
Contributor

@hungvu193 Any Idea where was this broken?

AFAIK, there're AvatarWithImagePicker, AttachmentModal and NewTaskPage.
But in NewTaskPage, we're clearing the error when the props change so we won't see the bug.

@melvin-bot
Copy link

melvin-bot bot commented Jul 30, 2023

📣 @hungvu193 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@dhairyasenjaliya
Copy link
Contributor

@deetergp i think we should hold until this PR We are adding
dotIndicator to display error and this issue can be worked after this #23754

@Santhosh-Sellavel
Copy link
Collaborator

@adelekennedy That makes sense, let's hold this for #23754

@deetergp deetergp changed the title [$1000] Attachment ValidationModal texts are not translated to Spanish [HOLD #23754][$1000] Attachment ValidationModal texts are not translated to Spanish Jul 31, 2023
@deetergp deetergp added Weekly KSv2 and removed Daily KSv2 labels Jul 31, 2023
@deetergp
Copy link
Contributor

I put a hold on this one pending the outcome of #23754. I've also made it a weekly for now.

@Santhosh-Sellavel
Copy link
Collaborator

Thank you @deetergp!

@Santhosh-Sellavel
Copy link
Collaborator

@hungvu193 @deetergp

#23754 is off hold, we can resume the work here.

@hungvu193
Copy link
Contributor

@hungvu193 @deetergp

#23754 is off hold, we can resume the work here.

Cool. I'll start a PR later today

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Aug 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

🎯 ⚡️ Woah @Santhosh-Sellavel / @hungvu193, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @hungvu193 got assigned: 2023-07-30 16:29:52 Z
  • when the PR got merged: 2023-08-02 23:46:58 UTC

On to the next one 🚀

@Santhosh-Sellavel
Copy link
Collaborator

@adelekennedy or @deetergp remove the Hold from title thanks!

@deetergp deetergp changed the title [HOLD #23754][$1000] Attachment ValidationModal texts are not translated to Spanish [$1000] Attachment ValidationModal texts are not translated to Spanish Aug 3, 2023
@deetergp
Copy link
Contributor

deetergp commented Aug 3, 2023

@Santhosh-Sellavel Done!

@Santhosh-Sellavel
Copy link
Collaborator

This has been deployed to production 2 days ago. Please update labels @adelekennedy

@adelekennedy adelekennedy changed the title [$1000] Attachment ValidationModal texts are not translated to Spanish [HOLD for payment 2023-08-16][$1000] Attachment ValidationModal texts are not translated to Spanish Aug 15, 2023
@adelekennedy adelekennedy added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Aug 16, 2023
@adelekennedy
Copy link

huh - annoying that it isn't updating automatically.

@adelekennedy
Copy link

Payouts due:

Contributor: $1000 for issue fix, + reporting bonus ($250) @hungvu193 (paid via Upwork)
Contributor+: $1000 for issue fix @Santhosh-Sellavel (paid via NewDot)

Eligible for 50% #urgency bonus? Y

Upwork job is here.

@adelekennedy
Copy link

@Santhosh-Sellavel will you post the checklist?

@Santhosh-Sellavel
Copy link
Collaborator

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@Santhosh-Sellavel
Copy link
Collaborator

Requested on ND

@JmillsExpensify
Copy link

Reviewed the details for @Santhosh-Sellavel. $1,500 approved for payment via NewDot based on BZ summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants