Skip to content

[Awaiting Payment 11th Jan] [$500] Chat-"Hmm... it's not here" appears after clicking Previous arrow from an attachment preview #31105

Closed

Description

@izarutskaya

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.3.97-1
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
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @

Action Performed:

  1. Create a request with a receipt via Request Money > Scan` (if you don't have one already)
  2. Navigate to the IOU report
  3. Add an attachment to the IOU report via + > Add attachment
  4. Click on the uploaded attachment
  5. Tap the < arrow in the attachment carousal
  6. Observe the "Hmm it's not here" page

Expected Result:

The uploaded receipt can be seen in the attachment carousal modal

Actual Result:

The uploaded receipt can not be seen and "Hmm... it's not here" appears after clicking the < navigation arrow from an attachment preview

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

Add any screenshot/video evidence

Bug6269678_1699519179592.2023-11-09_09-37-40.mp4

Bug6269678_1699519179590!Receipt_preview_hmm_its_not_here

Bug6269678_1699519463833!IMG_20231109_114404

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a232fe720233dddb
  • Upwork Job ID: 1722561095734079488
  • Last Price Increase: 2023-11-09
  • Automatic offers:
    • dukenv0307 | Contributor | 27703336
    • shubham1206agra | Contributor | 28051420
Issue OwnerCurrent Issue Owner: @trjExpensify

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 9, 2023
  2. changed the title [-]Chat-"Hmm... it's not here" appears after clicking Previous arrow from an attachment preview[/-] [+][$500] Chat-"Hmm... it's not here" appears after clicking Previous arrow from an attachment preview[/+] on Nov 9, 2023
  3. melvin-bot commented on Nov 9, 2023

    @melvin-bot
  4. melvin-bot commented on Nov 9, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 9, 2023
  6. melvin-bot commented on Nov 9, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Nov 9, 2023

    @melvin-bot

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

  8. dukenv0307 commented on Nov 9, 2023

    @dukenv0307
    Contributor

    Proposal

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

    "Hmm... it's not here" appears after clicking Previous arrow from an attachment preview

    What is the root cause of that problem?

    We get parent report action here to compare transactionID. But the report here is IOU report that makes parent report action is report preview action and then this check is wrong and not found page appears.

    const action = ReportActionsUtils.getParentReportAction(report);

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

    We should check here if the report is IOU or Expense report we shouldn't add this action to attachemnt list

    const transactionID = lodashGet(action, ['originalMessage', 'IOUTransactionID']);

    What alternative solutions did you explore? (Optional)

    We can remove the receipt image from carousal

    1. Update this case to return if the action is money request action
    if (!ReportActionsUtils.shouldReportActionBeVisible(action, key) || ReportActionsUtils.isMoneyRequestAction(action)) {
        return;
    }
    

    if (!ReportActionsUtils.shouldReportActionBeVisible(action, key)) {

    2. remove the compare transactionID on compareImage function

    const compareImage = useCallback(
        (attachment) => {
            return attachment.source === source;
        },
        [source, report, isReceipt],
    );
    

    const compareImage = useCallback(

    1. In AttachmentModal, add an extra prop like isReceiptImage and replace isAttachmentReceipt state with this prop
    2. Update this condition here to not open carouse for receipt image
    !_.isEmpty(props.report) && !props.isReceiptImage
    

    {!_.isEmpty(props.report) ? (

    1. In MoneyRequestView, we will pass full source of receipt into ReportActionItemImage.

    1. In ReportActionItemImage component, we will add an AttachmentModal, and then when we click on the receipt image we will open this modal instead of navigating to report attachment page.
    <AttachmentModal
        headerTitle={'Receipt'}
        source={source}
        isAuthTokenRequired
        report={report}
        isReceiptImage
        allowToDownload
    >
        {({show}) => (
            <PressableWithoutFocus
                style={[styles.noOutline, styles.w100, styles.h100]}
                onPress={show}
                role={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON}
                accessibilityLabel={translate('accessibilityHints.viewAttachment')}
            >
                {receiptImageComponent}
            </PressableWithoutFocus>
        )}
        
    </AttachmentModal>
    

    Result

    Screen.Recording.2023-11-14.at.08.11.58.mov
  9. trjExpensify commented on Nov 9, 2023

    @trjExpensify
    Contributor

    We get parent report action here to compare transactionID. But the report here is IOU report that makes this check is wrong and not found page appears.

    I think the proposal lacks a little specificity as to the root cause. Why does this only happen when the receipt is still scanning though? For example here I'm in a transaction thread on an iou report and the carousel works just fine:

    ql9FfgDys6.mp4
  10. esh-g commented on Nov 9, 2023

    @esh-g
    Contributor

    Proposal

    Please re-state the problem we are trying to solve

    "Hmm... it's not here" appears after clicking Previous arrow from an attachment preview

    What is the root cause of this problem?

    Parent report action transaction ID checking is done wrong here:

    const compareImage = useCallback(
    (attachment) => {
    if (attachment.isReceipt && isReceipt) {
    const action = ReportActionsUtils.getParentReportAction(report);
    const transactionID = _.get(action, ['originalMessage', 'IOUTransactionID']);
    return attachment.transactionID === transactionID;
    }
    return attachment.source === source;
    },
    [source, report, isReceipt],
    );

    Because originalMessage.IOUTransactionID doesn't exist on the parent report action.

    Screenshot 2023-11-09 at 4 38 27 PM

    What changes should be made to fix this?

    We can skip the separate checking for receipt and use the same way that other attachments are checked with their source attribute because the source attribute always exists
    Change the compareImage function to the following:

    const compareImage = useCallback(
            (attachment) => {
                return attachment.source === source;
            },
            [source],
        );

    What alternative did you explore?

    We can remove the receipts from the attachments altogether by the following:

    1. Remove the code to extract receipts as attachments here:

      // We're handling receipts differently here because receipt images are not
      // part of the report action message, the images are constructed client-side
      if (ReportActionsUtils.isMoneyRequestAction(action)) {
      const transactionID = lodashGet(action, ['originalMessage', 'IOUTransactionID']);
      if (!transactionID) {
      return;
      }
      const transaction = TransactionUtils.getTransaction(transactionID);
      if (TransactionUtils.hasReceipt(transaction)) {
      const {image} = ReceiptUtils.getThumbnailAndImageURIs(transaction);
      const isLocalFile = typeof image === 'string' && (image.startsWith('blob:') || image.startsWith('file:'));
      attachments.unshift({
      source: tryResolveUrlFromApiRoot(image),
      isAuthTokenRequired: !isLocalFile,
      file: {name: transaction.filename},
      isReceipt: true,
      transactionID,
      });
      return;
      }
      }

    2. Change the compareImage function as mentioned in the change above (maybe remove the function use an inline function for it)

    3. We can also remove the isReceipt state from the component and all the invocations where it is used.

  11. dukenv0307 commented on Nov 9, 2023

    @dukenv0307
    Contributor

    @trjExpensify After the scan is complete we also can reproduce this issue and this issue happens on IOU report not in transaction report.

  12. 88 remaining items

  13. changed the title [-][$500] Chat-"Hmm... it's not here" appears after clicking Previous arrow from an attachment preview[/-] [+][Awaiting Payment 11th Jan] [$500] Chat-"Hmm... it's not here" appears after clicking Previous arrow from an attachment preview[/+] on Jan 8, 2024
  14. trjExpensify commented on Jan 8, 2024

    @trjExpensify
    Contributor

    Sure, done!

  15. trjExpensify commented on Jan 12, 2024

    @trjExpensify
    Contributor

    Okay, so confirming payments as follows:

    Payment has been reduced accordingly due to the regression. Sound right?

  16. mananjadhav commented on Jan 12, 2024

    @mananjadhav
    Collaborator

    fyi, there were more than one regressions. I had helped with the proposal reviews and the review of the first PR that caused the first regression. Subsequently during my OOO it was assigned to @shubham1206agra.

    Would like to request for partial compensation for the initial effort.

  17. shubham1206agra commented on Jan 12, 2024

    @shubham1206agra
    Contributor

    yes correct. @dukenv0307 should take responsible for fixing it.
    And then I don't suggest to apply regression penalty given the efforts they made to fix this issue so far (just my suggestion)

    @trjExpensify didn't you agree to not to apply regression reduction of payment here?

  18. situchan commented on Jan 12, 2024

    @situchan
    Contributor

    I imagine split compensation 1k into 3 people 😄

  19. trjExpensify commented on Jan 12, 2024

    @trjExpensify
    Contributor

    Ah, I missed Manan reviewing the first PR.

    @trjExpensify didn't you agree to not to apply regression reduction of payment here?

    I interpreted @situchan's suggestion as not penalising for the second regression with the follow-up PR, which would result in $0 technically, which I agreed with.

  20. mananjadhav commented on Jan 19, 2024

    @mananjadhav
    Collaborator

    Ah, I missed Manan reviewing the first PR.

    @trjExpensify Can you accommodate me ;)

  21. trjExpensify commented on Jan 19, 2024

    @trjExpensify
    Contributor

    Yep! I've updated the payment summary here to add that. Go ahead and request.

    Drawing a line in the sand, @dukenv0307 I've paid you $250. @shubham1206agra I've sent the offer for the same. Once accepted, I'll settle and close this out.

  22. shubham1206agra commented on Jan 19, 2024

    @shubham1206agra
    Contributor

    @trjExpensify Accepted

  23. trjExpensify commented on Jan 19, 2024

    @trjExpensify
    Contributor

    Settled up!

  24. JmillsExpensify commented on Jan 22, 2024

    @JmillsExpensify
    Contributor

    $250 payment approved for @mananjadhav based on this comment.

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions