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

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

Closed
3 of 6 tasks
izarutskaya opened this issue Nov 9, 2023 · 83 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 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@izarutskaya
Copy link

izarutskaya commented Nov 9, 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!


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
@izarutskaya izarutskaya added 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 Nov 9, 2023
@melvin-bot melvin-bot bot 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 Nov 9, 2023
Copy link

melvin-bot bot commented Nov 9, 2023

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

Copy link

melvin-bot bot commented Nov 9, 2023

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

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

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

Copy link

melvin-bot bot commented Nov 9, 2023

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

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 9, 2023

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

@trjExpensify
Copy link
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

@esh-g
Copy link
Contributor

esh-g commented Nov 9, 2023

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.

@dukenv0307
Copy link
Contributor

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

@dukenv0307
Copy link
Contributor

Screen.Recording.2023-11-09.at.18.03.54.mov

@trjExpensify
Copy link
Contributor

Alright, these steps in the OP can be simplified. I've updated them:

  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

@trjExpensify
Copy link
Contributor

So @dukenv0307 why does this work fine in the transaction thread but not the IOU report?

@dukenv0307
Copy link
Contributor

@trjExpensify The current check now is used for transantion report so it works fine. parent action of transaction report will be a iou action that contain transactionID in originalMessage.

@DylanDylann
Copy link
Contributor

Proposal

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

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

What is the root cause of that problem?

const attachmentsFromReport = extractAttachmentsFromReport(report, reportActions);
const initialPage = _.findIndex(attachmentsFromReport, compareImage);
// Dismiss the modal when deleting an attachment during its display in preview.
if (initialPage === -1 && _.find(attachments, compareImage)) {
Navigation.dismissModal();
} else {
setPage(initialPage);

The logic of compareImage function is incorrect, It cause in line 63 we setPage(-1) --> Not Found Page.

Let see the logic of compareImage function

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;

The logic to get the current transactionID is incorrect. It is only correct in the Transaction Thread
Screenshot 2023-11-10 at 14 49 14

With IOU/Expense Report

Screenshot 2023-11-10 at 14 50 04

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

This logic is incorrect.

It explains why this bug only happens in IOU report (not in Transaction Thread)

Note that: If we get transactionID based on report and reportAction props, for each report type, we need a separate logic to get transactionID

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

We should create new state called currentTransactionID
In here

setIsReceipt(entry.item.isReceipt);

we will call setCurrentTransactionID(entry.item.transactionID) and use currentTransactionID instead of this logic

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

Result

Screen.Recording.2023-11-10.at.14.56.31.mov

@mananjadhav
Copy link
Collaborator

Checked the proposals, and @dukenv0307's proposal looks good.

🎀 👀 🎀 C+ reviewed.

Copy link

melvin-bot bot commented Nov 10, 2023

Triggered auto assignment to @mountiny, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@DylanDylann
Copy link
Contributor

DylanDylann commented Nov 11, 2023

@dukenv0307 In the yout main solution

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

You mean that with the IOU report, in AttachmentCarousel we will not scroll to the receipt image, we only scroll attachment

cc @mananjadhav

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 11, 2023

@DylanDylann Yes because if we don't send any attachment we don't have the way to open reciept in IOU report.

If we want to show it in IOU report, I have a solution that is we will add an contextMenu action like view reciept which will show if the report action is reciept request and when click on this action, we will navigate to report attachment. And in attachment carous, we can replace isReciept state by transactionID and use this state to compare with attachment.transactionID

@DylanDylann
Copy link
Contributor

In case, user send an attachment to IOU report. What happen?

@dukenv0307
Copy link
Contributor

@DylanDylann With my main solution, when we click on any attachment, reciept image doesn't show in the list.

@DylanDylann
Copy link
Contributor

@dukenv0307 Thanks for your explanation, I think that we should display the receipt in the scroll list in the IOU report like we did in transaction thread
@mananjadhav I think we should confirm the expected before moving forward
@trjExpensify In the IOU report, when user click to attachment, the scroll list will display to allow user move to next/previous image. Should we display the receipt image of request in this list? Could you help to confirm the expected in this case?
cc @shawnborton Ping you here to get some opinion from UX perspective

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@trjExpensify
Copy link
Contributor

@trjExpensify In the IOU report, when user click to attachment, the scroll list will display to allow user move to next/previous image. Should we display the receipt image of request in this list? Could you help to confirm the expected in this case?

I don't see a reason to not allow that. We do in the transaction thread for example as illustrated here.

@trjExpensify
Copy link
Contributor

So the second PR to fix the regression from the first PR is this one: #31105 (comment)

That has a couple of days to still go, but @situchan you're saying there's now a new regression from that 2nd PR: #31105 (comment)

If I have that correct, I think we need to remove the payment hold to await Melv adding that again on the deploy of it?

@situchan
Copy link
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 trjExpensify changed the title [HOLD for payment 2023-12-15] [$500] 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 Dec 21, 2023
@trjExpensify trjExpensify added Reviewing Has a PR in review and removed Awaiting Payment Auto-added when associated PR is deployed to production labels Dec 21, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

@mananjadhav, @trjExpensify, @mountiny, @shubham1206agra, @dukenv0307 Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Jan 1, 2024

@mananjadhav, @trjExpensify, @mountiny, @shubham1206agra, @dukenv0307 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

Copy link

melvin-bot bot commented Jan 3, 2024

@mananjadhav, @trjExpensify, @mountiny, @shubham1206agra, @dukenv0307 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

@mountiny
Copy link
Contributor

mountiny commented Jan 4, 2024

@situchan @dukenv0307 What are the next steps here please?

@dukenv0307
Copy link
Contributor

The regression is merged, waiting it deploy to production to complete the payment here.

@mountiny
Copy link
Contributor

mountiny commented Jan 4, 2024

Thanks

Copy link

melvin-bot bot commented Jan 5, 2024

@mananjadhav, @trjExpensify, @mountiny, @shubham1206agra, @dukenv0307 10 days overdue. I'm getting more depressed than Marvin.

@shubham1206agra
Copy link
Contributor

@trjExpensify Can you add the correct labels again for payment? It is due on 11th January.

@trjExpensify trjExpensify added the Awaiting Payment Auto-added when associated PR is deployed to production label Jan 8, 2024
@trjExpensify trjExpensify 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 Jan 8, 2024
@trjExpensify
Copy link
Contributor

Sure, done!

@trjExpensify
Copy link
Contributor

trjExpensify commented Jan 12, 2024

Okay, so confirming payments as follows:

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

@mananjadhav
Copy link
Collaborator

mananjadhav commented Jan 12, 2024

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.

@shubham1206agra
Copy link
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?

@situchan
Copy link
Contributor

I imagine split compensation 1k into 3 people 😄

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Jan 14, 2024
@mananjadhav
Copy link
Collaborator

Ah, I missed Manan reviewing the first PR.

@trjExpensify Can you accommodate me ;)

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

@shubham1206agra
Copy link
Contributor

@trjExpensify Accepted

@trjExpensify
Copy link
Contributor

Settled up!

@JmillsExpensify
Copy link

$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
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

10 participants