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-10-27][$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt #29855

Closed
6 tasks done
izarutskaya opened this issue Oct 18, 2023 · 36 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Oct 18, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Issue found when executing PR: #29474

Version Number: v1.3.86-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:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Expensify/Expensify Issue URL:

Issue reported by: Applause-Internal Team

Slack conversation: @

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to chat > + > Request money > Manual.
  3. Enter amount and proceed to confirmation page.
  4. Click 3-dot menu > Add receipt.
  5. Select a receipt.

Expected Result:

The receipt will appear in the preview in the confirmation page.

Actual Result:

The preview in the confirmation page shows the attachment placeholder instead of the receipt.

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Bug6241508_1697620648971.20231018_101020.mp4
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c60a9f52756a7c9e
  • Upwork Job ID: 1714605323478552576
  • Last Price Increase: 2023-10-18
  • Automatic offers:
    • fedirjh | Reviewer | 27261363
    • c3024 | Contributor | 27261368
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@melvin-bot melvin-bot bot changed the title Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt [$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt Oct 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 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

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

melvin-bot bot commented Oct 18, 2023

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

@izarutskaya
Copy link
Author

Not repro in production

bandicam.2023-10-18.15-36-18-490.mp4

@OSBotify
Copy link
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.

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

Triggered auto assignment to @cristipaval (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@c3024
Copy link
Contributor

c3024 commented Oct 18, 2023

Proposal

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

Image is not shown in confirm page when creating a scan money request

What is the root cause of that problem?

We get the image and thumbnail from here

const {image: receiptImage, thumbnail: receiptThumbnail} = props.receiptPath && props.receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction) : {};

but when we have not created the transaction yet there is no source or file name for the transaction and this returns this
return {thumbnail: null, image};

and the image is generic image here
let image = ReceiptGeneric;

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

We should check if the transaction does not have a source and we should get the image and thumbnail with iou receiptPath and filename
So we change this code

const {image: receiptImage, thumbnail: receiptThumbnail} = props.receiptPath && props.receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction) : {};

to something like this

if (!transaction.source) {
    const uris = props.receiptPath && props.receiptFilename 
        ? ReceiptUtils.getThumbnailAndImageURIsFromIOU(props.receiptPath, props.receiptFilename)
        : {};

    receiptImage = uris.image;
    receiptThumbnail = uris.thumbnail;
} else {
    const uris = props.receiptPath && props.receiptFilename 
        ? ReceiptUtils.getThumbnailAndImageURIs(transaction)
        : {};

    receiptImage = uris.image;
    

and add the function which we were using earlier in ReceiptUtils like this

function getThumbnailAndImageURIsFromIOU(path: string, filename: string): ThumbnailAndImageURI {
    const isReceiptImage = Str.isImage(filename);

    // For local files, we won't have a thumbnail yet
    if (isReceiptImage && (path.startsWith('blob:') || path.startsWith('file:'))) {
        return {thumbnail: null, image: path};
    }

    if (isReceiptImage) {
        return {thumbnail: `${path}.1024.jpg`, image: path};
    }

    const {fileExtension} = FileUtils.splitExtensionFromFileName(filename) as FileNameAndExtension;
    let image = ReceiptGeneric;
    if (fileExtension === CONST.IOU.FILE_TYPES.HTML) {
        image = ReceiptHTML;
    }

    if (fileExtension === CONST.IOU.FILE_TYPES.DOC || fileExtension === CONST.IOU.FILE_TYPES.DOCX) {
        image = ReceiptDoc;
    }

    if (fileExtension === CONST.IOU.FILE_TYPES.SVG) {
        image = ReceiptSVG;
    }

    return {thumbnail: null, image};
}

We can move all this common code into a helper function

    if (isReceiptImage && (path.startsWith('blob:') || path.startsWith('file:'))) {
        return {thumbnail: null, image: path};
    }

    if (isReceiptImage) {
        return {thumbnail: `${path}.1024.jpg`, image: path};
    }

    const {fileExtension} = FileUtils.splitExtensionFromFileName(filename) as FileNameAndExtension;
    let image = ReceiptGeneric;
    if (fileExtension === CONST.IOU.FILE_TYPES.HTML) {
        image = ReceiptHTML;
    }

    if (fileExtension === CONST.IOU.FILE_TYPES.DOC || fileExtension === CONST.IOU.FILE_TYPES.DOCX) {
        image = ReceiptDoc;
    }

    if (fileExtension === CONST.IOU.FILE_TYPES.SVG) {
        image = ReceiptSVG;
    }

    return {thumbnail: null, image};

and use it both for getting image and thumbnail from transaction or iou

What alternative solutions did you explore? (Optional)

We can pass props.receiptPath, props.receiptFilename to
ReceiptUtils.getThumbnailAndImageURIs(transaction) here

const {image: receiptImage, thumbnail: receiptThumbnail} = props.receiptPath && props.receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction) : {};

as
ReceiptUtils.getThumbnailAndImageURIs(transaction, props.receiptPath, props.receiptFilename) and change params of getThumbnailAndImageURIs in ReceiptUtils to (transaction, receiptPath, receiptFileName) and these lines in getThumbnailAndImageURIs to

const path = transaction?.receipt?.source || receiptPath || '' ;
    // filename of uploaded image or last part of remote URI
    const filename = transaction?.filename || receiptFilename || '';

@fedirjh
Copy link
Contributor

fedirjh commented Oct 18, 2023

@c3024 Can you please link which PR has introduced this bug?

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@c3024

This comment was marked as outdated.

@cristipaval
Copy link
Contributor

cristipaval commented Oct 18, 2023

@fedirjh I think this PR introduced this regression, and @youssef-lr reported it already here

@cristipaval
Copy link
Contributor

#29794 which changed the passing of receipt file and name to the getThumbnailAndImageURIs to passing transaction as parameter

@c3024 I think you copy-pasted the wrong PR, didn't you?

@c3024
Copy link
Contributor

c3024 commented Oct 18, 2023

Yes. Sorry #29474 it is.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 18, 2023
@melvin-bot melvin-bot bot changed the title [$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt [HOLD for payment 2023-10-25] [$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt Oct 18, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.86-5 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 2023-10-25. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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:

  • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
  • [@fedirjh] 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:
  • [@fedirjh] 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:
  • [@fedirjh] Determine if we should create a regression test for this bug.
  • [@fedirjh] 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 20, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-25] [$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt [HOLD for payment 2023-10-27] [HOLD for payment 2023-10-25] [$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.87-12 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 2023-10-27. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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:

  • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
  • [@fedirjh] 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:
  • [@fedirjh] 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:
  • [@fedirjh] Determine if we should create a regression test for this bug.
  • [@fedirjh] 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.
  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mallenexpensify mallenexpensify changed the title [HOLD for payment 2023-10-27] [HOLD for payment 2023-10-25] [$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt [HOLD for payment 2023-10-27][$500] Manual - Attachment placeholder is shown in preview instead of receipt after adding a receipt Oct 23, 2023
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 25, 2023
@fedirjh
Copy link
Contributor

fedirjh commented Oct 26, 2023

BugZero Checklist:


Regression Test Proposal

  1. Click on FAB > Request Money > Manual
  2. Input an amount and click Next
  3. Enter/select an option for the request
  4. Click on the three-dot menu at the top right
  5. Click on "Add Receipt"
  6. Click on "Choose File" and Select an image
  7. Verify that the image is shown as a receipt
  • Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@garrettmknight, @cristipaval, @fedirjh, @c3024 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@cristipaval
Copy link
Contributor

  • [@garrettmknight] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@garrettmknight , could you please create a GH issue with the regression steps suggested by @fedirjh in the previous comment?

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@garrettmknight
Copy link
Contributor

Done!

Summary of payments:

  • Urgency bonus: Yes
  • Contributor: @c3024 750 paid via Upwork
  • Reviewer: @fedirjh $750 paid via Upwork

@mallenexpensify
Copy link
Contributor

@garrettmknight
Copy link
Contributor

Planned here: #31432

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. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants