Skip to content

[HOLD for payment 2024-08-19] [$250] Expense - Receipt thumbnail shows a green receipt placeholder while it is uploading #47050

Closed

Description

@IuliiaHerets

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: v9.0.18-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: https://expensify.testrail.io/index.php?/tests/view/4834235
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to FAB > Submit expense > Manual.
  3. Submit a manual expense with receipt to any user.
  4. After submitting the expense, check the receipt thumbnail while it is uploading.

Expected Result:

The receipt thumbnail will show the receipt while it is uploading (production behavior).

Actual Result:

The receipt thumbnail shows a green receipt placeholder while it is uploading.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6565240_1723090380276.20240808_120954.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cb9e52d752d2515a
  • Upwork Job ID: 1821642583324627537
  • Last Price Increase: 2024-08-08
Issue OwnerCurrent Issue Owner: @adelekennedy

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Aug 8, 2024
  2. melvin-bot commented on Aug 8, 2024

    @melvin-bot

    Triggered auto assignment to @madmax330 (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. melvin-bot commented on Aug 8, 2024

    @melvin-bot

    Triggered auto assignment to @adelekennedy (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.

  4. github-actions commented on Aug 8, 2024

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. IuliiaHerets commented on Aug 8, 2024

    @IuliiaHerets
    Author

    We think that this bug might be related to #wave-collect - Release 1

  6. madmax330 commented on Aug 8, 2024

    @madmax330
    Contributor
  7. bernhardoj commented on Aug 8, 2024

    @bernhardoj
    Contributor

    Proposal

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

    Reciept image is shown as green receipt placeholder.

    What is the root cause of that problem?

    In this issue, the receipt image is shown as EReceiptThumbnail because isThumbnail is true.

    if (isEReceipt || isThumbnail) {
    const props = isThumbnail && {borderRadius: style?.borderRadius, fileExtension, isReceiptThumbnail: true};
    return (
    <View style={style ?? [styles.w100, styles.h100]}>
    <EReceiptThumbnail
    transactionID={transactionID ?? '-1'}
    iconSize={iconSize}
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...props}
    />
    </View>
    );
    }

    In ReceiptUtils, we have a logic to return the correct data if it's a receipt image, but in our case, isReceiptImage is false.

    if ((isReceiptImage || isReceiptPDF) && typeof path === 'string' && (path.startsWith('blob:') || path.startsWith('file:'))) {
    return {image: path, isLocalFile: true, filename};
    }
    if (isReceiptImage) {
    return {thumbnail: `${path}.1024.jpg`, image: path, filename};
    }
    if (isReceiptPDF && typeof path === 'string') {
    return {thumbnail: `${path.substring(0, path.length - 4)}.jpg.1024.jpg`, image: path, filename};
    }
    const isLocalFile = FileUtils.isLocalFile(path);
    const {fileExtension} = FileUtils.splitExtensionFromFileName(filename);
    return {isThumbnail: true, fileExtension: Object.values(CONST.IOU.FILE_TYPES).find((type) => type === fileExtension), image: path, isLocalFile, filename};

    isReceiptImage checks the extension of the image filename.

    const isReceiptImage = Str.isImage(filename);

    However, the image filename contains the image source (blob://...). This happens after this commit. In that commit, we move the creating of the optimistic receipt and filename to buildOptimisticTransaction, but we got the logic for the filename wrong.

    Previously, if the receipt has the source, then the filename will be set to the receipt name.
    image

    Now, it will use the source and fallback to receipt name (and then fallback to filename param).

    filename: receipt?.source ?? receipt?.name ?? filename,

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

    We should change the logic of the optimsitic filename just like before to:

    filename: receipt?.source ? receipt?.name : filename,
    

    maybe we can check for the receipt name instead, (receipt?.name ?? filename)

  8. 26 remaining items

  9. melvin-bot commented on Aug 12, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  10. melvin-bot commented on Aug 12, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.18-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-08-19. 🎊

    For reference, here are some details about the assignees on this issue:

    • @bernhardoj requires payment through NewDot Manual Requests
  11. melvin-bot commented on Aug 12, 2024

    @melvin-bot

    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:

    • [@madmax330 / @neil-marcellini] The PR that introduced the bug has been identified. Link to the PR:
    • [@madmax330 / @neil-marcellini] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@madmax330 / @neil-marcellini] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@bernhardoj] Determine if we should create a regression test for this bug.
    • [@bernhardoj] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@adelekennedy] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  12. adelekennedy commented on Aug 13, 2024

    @adelekennedy
    Contributor

    Hey @bernhardoj I think in this case you're owed 50% of the usual price as we used your solution but @neil-marcellini implemented it. Does that sound fair?

  13. removed
    DeployBlockerCashThis issue or pull request should block deployment
    DeployBlockerIndicates it should block deploying the API
    on Aug 13, 2024
  14. Beamanator commented on Aug 13, 2024

    @Beamanator
    Contributor

    Removing blocker labels since this is def not a new blocker 😬

  15. adelekennedy commented on Aug 13, 2024

    @adelekennedy
    Contributor

    🤦‍♀️ I completely missed those labels @Beamanator, thank you

  16. Beamanator commented on Aug 13, 2024

    @Beamanator
    Contributor

    No prob! :D

  17. bernhardoj commented on Aug 14, 2024

    @bernhardoj
    Contributor

    @adelekennedy yes, that make sense for me

  18. adelekennedy commented on Aug 14, 2024

    @adelekennedy
    Contributor

    great! Thank you so much for bringing this up

    Payouts due:

  19. bernhardoj commented on Aug 14, 2024

    @bernhardoj
    Contributor

    Requested in ND.

  20. JmillsExpensify commented on Aug 14, 2024

    @JmillsExpensify
    Contributor

    $125 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions