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-11-01] [HOLD for payment 2023-10-31] [$500] [HIGH] [P2P Activation] System message is showing in the chat preview in LHN #30037

Closed
kevinksullivan opened this issue Oct 19, 2023 · 29 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

@kevinksullivan
Copy link
Contributor

kevinksullivan commented Oct 19, 2023

coming from https://expensify.slack.com/archives/C05RECHFBEW/p1697754930131319

and related to changes in #29430

The system message for needing to enable a wallet should only show on the IOU, and not in the DM as well (since the message doesn't show in the DM at all).

image

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c788d51e8ac49ab8
  • Upwork Job ID: 1715150172239216640
  • Last Price Increase: 2023-10-20
  • Automatic offers:
    • situchan | Reviewer | 27294351
    • b4s36t4 | Contributor | 27294353
@kevinksullivan kevinksullivan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

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

@melvin-bot
Copy link

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

@trjExpensify
Copy link
Contributor

trjExpensify commented Oct 19, 2023

Interesting, yeah!

  1. The last message in the DM is the report preview component of the iouReport with the title: "Money2020 paid $1.00"
  2. The last action in the iouReport is: "started settling up, payment is held until Kevin adds a bank account."
  3. For some reason the last action is being shown instead of the iouReport title

@kevinksullivan, so confirming when we fix this the two LHN rows will be as follows:

iouReport

Money2020 paid $1.00
started settling up, payment is held until %recipient firstName% enables the Expensify Wallet

DM

Kevin Sullivan
Money2020 paid $1.00

@trjExpensify trjExpensify added the Internal Requires API changes or must be handled by Expensify staff label Oct 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

Triggered auto assignment to Contributor Plus for review of internal employee PR - @jjcoffee (Internal)

@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

Current assignee @techievivek is eligible for the Engineering assigner, not assigning anyone new.

@kevinksullivan
Copy link
Contributor Author

started settling up, payment is held until Kevin adds a bank account.

One correction on this one @trjExpensify , it's this copy:

started settling up, payment is held until %recipient firstName% enables the Expensify Wallet

The copy you see in the screenshot is a duplicate message / separate issue. See https://github.com/Expensify/Auth/pull/8973

Rest looks good to me.

@trjExpensify
Copy link
Contributor

Perfect, fixed!

@b4s36t4
Copy link
Contributor

b4s36t4 commented Oct 20, 2023

Proposal

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

System message is showing in the chat preview in LHN

What is the root cause of that problem?

We get preview message for LHN option using getReportPreviewMessage this function from ReportUtils which takes the report and checks for conditions to return preview message.

if (report.isWaitingOnBankAccount) {
this is the line that returning the preview message in this function we don't have any way to check weather the report is 1:1 report or IOU report and so on.

Since we want to show that amount is paid we also need to edit this function to check weather the report is a chat report or not.

App/src/libs/ReportUtils.js

Lines 277 to 287 in ca51f6f

function isSettled(reportID) {
if (!allReports) {
return false;
}
const report = allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] || {};
if ((typeof report === 'object' && Object.keys(report).length === 0) || report.isWaitingOnBankAccount) {
return false;
}
return report.statusNum === CONST.REPORT.STATUS.REIMBURSED;
}

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

} else if (ReportActionUtils.isReportPreviewAction(lastReportAction)) {
const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(lastReportAction));
const lastIOUMoneyReport = _.find(
allSortedReportActions[iouReport.reportID],
(reportAction, key) =>
ReportActionUtils.shouldReportActionBeVisible(reportAction, key) &&
reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE &&
ReportActionUtils.isMoneyRequestAction(reportAction),
);
lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastIOUMoneyReport, true);
in this block of we're calling
getReportPreviewMessage with the IOU report which doesn't give any chance for us to tell weather the report is chat or not, since we're sending IOU report the type of report will always be iou

We need to introduce a vairable say isChatReport which checks weather the report is chatreport or not using ReportUtils.isChatReport and we can pass the result of the report the getReportPreviewMessage function in which need to pass the variable to isSettled function.

We need to introduce new parameters for functions like getReportPreviewMessage and isSettled.

Basically we need to pass the type of report if the reportAction is a type REPORTPREVIEW, as at this moment we only have the type as iou.

Changes:

  1. const isChatReport = ReportUtils.isChatReport(report) at here

    lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastIOUMoneyReport, true);

  2. Pass the created variable to function

    } else if (ReportActionUtils.isDeletedParentAction(lastReportAction) && ReportUtils.isChatReport(report)) {

  3. Pass the newly introduced variable to isSettled function here

    function isSettled(reportID) {

  4. Update the condition here to check weather the report is 1:1 report

    if ((typeof report === 'object' && Object.keys(report).length === 0) || report.isWaitingOnBankAccount) {

if ((typeof report === 'object' && Object.keys(report).length === 0) || (report.isWaitingOnBankAccount && !isChatReport))

What alternative solutions did you explore? (Optional)

NA

Will need to test few other flows which require's vivek changes in backend, if required will update the proposal again.

Screenshot 2023-10-20 at 2 59 33 PM

@techievivek techievivek assigned situchan and unassigned jjcoffee Oct 20, 2023
@techievivek techievivek added External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors and removed Internal Requires API changes or must be handled by Expensify staff labels Oct 20, 2023
@melvin-bot melvin-bot bot changed the title [HIGH] [P2P Activation] System message is showing in the chat preview in LHN [$500] [HIGH] [P2P Activation] System message is showing in the chat preview in LHN Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

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

@situchan
Copy link
Contributor

situchan commented Oct 20, 2023

To confirm the expected behavior:
System message should not show in DM (both LHN and report action)
System message should show in IOU report (both LHN and report action)

Just asking because I am not clear whether should show system message or not in LHN for IOU report

cc: @techievivek

@b4s36t4
Copy link
Contributor

b4s36t4 commented Oct 20, 2023

Screenshot 2023-10-20 at 5 00 15 PM

@situchan

@techievivek
Copy link
Contributor

Yes, what you mentioned is the expected behaviour we are looking for. Along with that, we also need to update the LHN content for both the report: #30037 (comment)

@trjExpensify
Copy link
Contributor

Just asking because I am not clear whether should show system message or not in LHN for IOU report

Yes we should. I.e

LHN Title: Money2020 paid $1.00
LHN Preview: started settling up, payment is held until %recipient firstName% enables the Expensify Wallet

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

melvin-bot bot commented Oct 20, 2023

📣 @situchan 🎉 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

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

🎯 ⚡️ Woah @situchan / @b4s36t4, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @b4s36t4 got assigned: 2023-10-20 12:51:21 Z
  • when the PR got merged: 2023-10-23 14:30:41 UTC

On to the next one 🚀

@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 24, 2023
@melvin-bot melvin-bot bot changed the title [$500] [HIGH] [P2P Activation] System message is showing in the chat preview in LHN [HOLD for payment 2023-10-31] [$500] [HIGH] [P2P Activation] System message is showing in the chat preview in LHN Oct 24, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.89-6 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-31. 🎊

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 24, 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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@trjExpensify] 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 25, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-31] [$500] [HIGH] [P2P Activation] System message is showing in the chat preview in LHN [HOLD for payment 2023-11-01] [HOLD for payment 2023-10-31] [$500] [HIGH] [P2P Activation] System message is showing in the chat preview in LHN Oct 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.90-2 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-11-01. 🎊

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 25, 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:

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

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 Daily KSv2 labels Oct 30, 2023
@trjExpensify
Copy link
Contributor

Checklist time! Bump, @situchan.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 2, 2023
@trjExpensify
Copy link
Contributor

Same, awaiting the checklist from @situchan. :)

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 6, 2023
Copy link

melvin-bot bot commented Nov 9, 2023

@trjExpensify, @techievivek, @b4s36t4, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@situchan
Copy link
Contributor

situchan commented Nov 9, 2023

This is new feature and follow-up of #29430.

I am not sure regression test is needed as it requires gold wallet which QA team doesn't have.

@melvin-bot melvin-bot bot removed the Overdue label Nov 9, 2023
@trjExpensify
Copy link
Contributor

We're discussing that question on the linked issue, so we can skip over that here. As for payments:

  • $750 to @b4s36t4 for the bug fix + #urgency bonus
  • $750 @situchan for the bug fix + #urgency bonus

Urgency bonus applies because this was prior to the change. Thanks ya'll!

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

6 participants