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

[$250] Send invoice - Invoice thread name can renamed when created offline #43582

Closed
6 tasks done
lanitochka17 opened this issue Jun 12, 2024 · 44 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Jun 12, 2024

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.4.82-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go offline.
  3. Go FAB > Send invoice.
  4. Send invoice to a user.
  5. Go to transaction thread.
  6. Click report header > Settings.
  7. Click Room name.
  8. Go online.
  9. Repeat Step 6 and 7.

Expected Result:

Invoice thread name cannot be renamed when created offline, because it can't be renamed online

Actual Result:

Invoice thread name can renamed when created offline

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

Bug6510719_1718191819509.20240612_192647.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0189569ee60be7065e
  • Upwork Job ID: 1803295776701776707
  • Last Price Increase: 2024-06-26
  • Automatic offers:
    • shubham1206agra | Reviewer | 102975673
    • cretadn22 | Contributor | 102975676
Issue OwnerCurrent Issue Owner: @
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 12, 2024
Copy link

melvin-bot bot commented Jun 12, 2024

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

@lanitochka17
Copy link
Author

@JmillsExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@Tony-MK
Copy link
Contributor

Tony-MK commented Jun 12, 2024

Proposal

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

Send invoice - Invoice thread name can renamed when created offline

What is the root cause of that problem?

The problem is that the MenuItem in ReportSettingsPage is always enabled when offline for every type of report.

{shouldDisableRename ? (
<View style={[styles.ph5, styles.pv3]}>
<Text
style={[styles.textLabelSupporting, styles.lh16, styles.mb1]}
numberOfLines={1}
>
{roomNameLabel}
</Text>
<DisplayNames

This is because the ReportUtils.shouldDisableRename function always does not check for invoice reports.

const shouldDisableRename = useMemo(() => ReportUtils.shouldDisableRename(report, linkedWorkspace), [report, linkedWorkspace]);

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

We should edit using the shouldDisableRename boolean but we need to edit the ReportUtils.shouldDisableRename function to include invoice reports.

App/src/libs/ReportUtils.ts

Lines 6103 to 6104 in 79e619a

if (isDefaultRoom(report) || isArchivedRoom(report) || isThread(report) || isMoneyRequestReport(report) || isPolicyExpenseChat(report)) {
return true;

So, let's use the ReportUtils.isInvoiceReport function in the condition above.

@cretadn22
Copy link
Contributor

cretadn22 commented Jun 12, 2024

Proposal

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

Send invoice - Invoice thread name can renamed when created offline

What is the root cause of that problem?

When operating online, the shouldDisableRename function will indicate true because the invoice report is a thread. However, in offline mode, since the invoice report lacks a 'parentReportActionID', the isThread function returns false, consequently causing shouldDisableRename to also return false.

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

When creating optimistic data for invoice report, we should include parentReportActionID

Currently, we're generating the invoice report prior to creating the optimistic report action

App/src/libs/actions/IOU.ts

Lines 1758 to 1759 in 79e619a

// STEP 2: Create a new optimistic invoice report.
const optimisticInvoiceReport = ReportUtils.buildOptimisticInvoiceReport(chatReport.reportID, senderWorkspaceID, receiverAccountID, receiver.displayName ?? '', amount, currency);

App/src/libs/actions/IOU.ts

Lines 1805 to 1806 in 79e619a

// STEP 5: Build optimistic reportActions.
const [optimisticCreatedActionForChat, optimisticCreatedActionForIOUReport, iouAction, optimisticTransactionThread, optimisticCreatedActionForTransactionThread] =

My suggestion is that we generate a random ID, similar to what we did when creating the optimistic report action

reportActionID: NumberUtils.rand64(),

Then we will use this reportActionID for both optimistic invoiceReport and optimistic reportAction

What alternative solutions did you explore? (Optional)

@Tony-MK
Copy link
Contributor

Tony-MK commented Jun 12, 2024

Proposal

Updated

@melvin-bot melvin-bot bot added the Overdue label Jun 14, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Jun 19, 2024
@melvin-bot melvin-bot bot changed the title Send invoice - Invoice thread name can renamed when created offline [$250] Send invoice - Invoice thread name can renamed when created offline Jun 19, 2024
Copy link

melvin-bot bot commented Jun 19, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0189569ee60be7065e

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 19, 2024
Copy link

melvin-bot bot commented Jun 19, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2024
@JmillsExpensify
Copy link

Added to vip invoicing and went ahead and opened up to the community.

Copy link

melvin-bot bot commented Jun 24, 2024

@JmillsExpensify, @shubham1206agra Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Jun 24, 2024
@JmillsExpensify
Copy link

Awaiting proposal review.

@JmillsExpensify JmillsExpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Jun 26, 2024
Copy link

melvin-bot bot commented Jun 26, 2024

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

@JmillsExpensify
Copy link

Not clear why this is overdue.

@melvin-bot melvin-bot bot removed the Overdue label Jun 26, 2024
@shubham1206agra
Copy link
Contributor

@cretadn22 Can you provide the test branch to test your proposal?

@cretadn22
Copy link
Contributor

The idea still be my proposal here. About detail implementation:

  1. When creating iouReport we generate a random reportActionID (And assign it to iouReport.parenReportActionID)
  2. When creating reportAction for chat report (in these function: buildOptimisticCreatedReportAction buildOptimisticReportPreview) we will use above reportActionID

@cretadn22
Copy link
Contributor

cretadn22 commented Jul 3, 2024

@shubham1206agra Could you point out what problem? I tested and it worked well

@shubham1206agra
Copy link
Contributor

The idea still be my proposal here. About detail implementation:

1. When creating iouReport we generate a random reportActionID (And assign it to iouReport.parenReportActionID)

2. When creating reportAction for chat report (in these function: buildOptimisticCreatedReportAction buildOptimisticReportPreview) we will use above reportActionID

You are kind of right, but we do not generate a random reportActionID. See other flow (submit expense) for solution.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

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

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 3, 2024

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

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@cretadn22
Copy link
Contributor

@shubham1206agra
I apologize if I've misunderstood anything. I checked the submitRequest process and saw that we generate a random reportActionID, which we then assign to iouReport.parentReportActionID.

App/src/libs/actions/IOU.ts

Lines 2039 to 2044 in 55546bb

reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction);
chatReport.lastVisibleActionCreated = reportPreviewAction.created;
// Generated ReportPreview action is a parent report action of the iou report.
// We are setting the iou report's parentReportActionID to display subtitle correctly in IOU page when offline.
iouReport.parentReportActionID = reportPreviewAction.reportActionID;

@cretadn22
Copy link
Contributor

But we do not generate a random reportActionID

Could you help to detail this point? We create request offline, how we can get new reportActionID if we don't generate it

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Jul 3, 2024

@shubham1206agra I apologize if I've misunderstood anything. I checked the submitRequest process and saw that we generate a random reportActionID, which we then assign to iouReport.parentReportActionID.

App/src/libs/actions/IOU.ts

Lines 2039 to 2044 in 55546bb

reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction);
chatReport.lastVisibleActionCreated = reportPreviewAction.created;
// Generated ReportPreview action is a parent report action of the iou report.
// We are setting the iou report's parentReportActionID to display subtitle correctly in IOU page when offline.
iouReport.parentReportActionID = reportPreviewAction.reportActionID;

@cretadn22 I want you to do a similar thing here. Do not change any function signature.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 4, 2024
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

This issue has not been updated in over 15 days. @JmillsExpensify, @youssef-lr, @shubham1206agra, @cretadn22 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Jul 29, 2024
@shubham1206agra
Copy link
Contributor

@JmillsExpensify It missed posting the payment date. It is August 1.

@cretadn22
Copy link
Contributor

@JmillsExpensify Is the payment available?

@cretadn22
Copy link
Contributor

@youssef-lr Could someone assist with processing the payment?

@JmillsExpensify
Copy link

Payment Summary:

@JmillsExpensify
Copy link

Contributor Upwork contract paid out.

@shubham1206agra
Copy link
Contributor

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:

  1. Go offline.
  2. Go FAB > Send invoice.
  3. Send invoice to a user.
  4. Go to transaction thread.
  5. Click report header > Settings.
  6. Verify that the Who can post option should be disabled.
  • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@shubham1206agra
Copy link
Contributor

@JmillsExpensify Please close this issue.

@shubham1206agra
Copy link
Contributor

@JmillsExpensify Bump here

@cretadn22
Copy link
Contributor

@youssef-lr Please close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review
Projects
Status: Done
Development

No branches or pull requests

6 participants