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

[$1000] "Owes you" message shows up in the search page after searching for a contact after settling a money request #19370

Closed
1 of 6 tasks
kavimuru opened this issue May 22, 2023 · 16 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 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

Comments

@kavimuru
Copy link

kavimuru commented May 22, 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!


Action Performed:

  1. Send a money request from account A to account B
  2. Settle the money request from account B
  3. Go to account A and click on FAB > New chat
  4. Input account B's email inside of the search input field

Expected Result:

User B should show up.

Actual Result:

"Owes you" message shows up and doesn't show account B

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.16.6
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
Notes/Photos/Videos: Any additional supporting documentation

2023-05-18.11.51.04.mp4
Recording.708.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Nathan-Mulugeta
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684400092434069

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018b1abad8b1af373d
  • Upwork Job ID: 1661084207028908032
  • Last Price Increase: 2023-05-23
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 22, 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

@huzaifa-99
Copy link
Contributor

huzaifa-99 commented May 22, 2023

Proposal

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

We want the proper user email/name to show up in search suggestions and hide the "owes you" message from user name if there is any

What is the root cause of that problem?

In ReportUtils.getMoneyRequestReportName we are adding the owns you message. In some cases it is needed like for displaying in LHN but not in the case of search.

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

We have to conditionally display the "owes you" message for results that need it. We can pass a prop shouldExcludeFormattedAmount to ReportUtils.getMoneyRequestReportName to only return the report payer name and exclude the "owes you" message.

function getMoneyRequestReportName(report, shouldExcludeFormattedAmount = false) {
    const payerName = isExpenseReport(report) ? getPolicyName(report) : getDisplayNameForParticipant(report.managerEmail);
    if (shouldExcludeFormattedAmount) {
        return payerName
    }

    const formattedAmount = CurrencyUtils.convertToDisplayString(getMoneyRequestTotal(report), report.currency);

    return Localize.translateLocal('iou.payerOwesAmount', { payer: payerName, amount: formattedAmount });
}

This prop will come from SearchPage.js#L61 -> OptionsListUtils.js#L772 -> OptionsListUtils.js#L533 -> OptionsListUtils.js#L366 -> ReportUtils.js#L1081 -> ReportUtils.js#L1055

What alternative solutions did you explore? (Optional)

We can return the payer name directly (in case of money request report) in a function higher up the hierarchy instead of drilling a prop like this.

@tienifr
Copy link
Contributor

tienifr commented May 22, 2023

Proposal

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

After settling a money request, the 'owes you' message shows up in the search page

What is the root cause of that problem?

As explained by @huzaifa-99 , this is happening because the option data coming from recent reports are being added with the owe message.

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

We can modify the text value in NewChatPage to use the username value instead.

-        const recentReportsWithoutSelected = _.filter(this.state.recentReports, ({login}) => !filterText.includes(login));
+        let recentReportsWithoutSelected = _.filter(this.state.recentReports, ({login}) => !filterText.includes(login));
+        recentReportsWithoutSelected = recentReportsWithoutSelected.map(report => ({
+            ...report,
+            text: ReportUtils.getDisplayNameForParticipant(report.login)
+       }))

What alternative solutions did you explore? (Optional)

We could consider adding a useDisplayName prop in getSearchOptions. Then, this prop could be passed all the way down to createOption, and we could add a check to use the user name for the displayed text, something like

if (useDisplayName) {
        result.text = ReportUtils.getDisplayNameForParticipant(report.managerEmail)
}

Result

Working well after the fix

screen-recording-2023-05-22-at-170532_MdNrIwGx.mp4

@bernhardoj
Copy link
Contributor

Proposal

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

When we search for a user, the new chat list will only show the money request report.

What is the root cause of that problem?

The new chat list shows the 5 most recent report and all user, except the user that already shown in the most recent by checking the login property.

Every money request will create a new report (assuming we don't have one) and it's also included in the list and the login attribute is the same as the login of the user we requested the money on. So, for example we request money to user A. First, it will be included in the most recent and the login is added to the exclude list.

// Add this login to the exclude list so it won't appear when we process the personal details
if (reportOption.login) {
loginOptionsToExclude.push({login: reportOption.login});
}

Then, when we are trying to include users into the new chat list, we will skip if the user login is in the exclude list.

// Next loop over all personal details removing any that are selectedUsers or recentChats
_.each(allPersonalDetailsOptions, (personalDetailOption) => {
if (_.some(loginOptionsToExclude, (loginOptionToExclude) => loginOptionToExclude.login === personalDetailOption.login)) {
return;
}

So, we can only see the money request report in the new chat, but not the user report.

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

We shouldn't push the money request report to the exclude list here:

// Add this login to the exclude list so it won't appear when we process the personal details
if (reportOption.login) {
loginOptionsToExclude.push({login: reportOption.login});
}

In addition to check if login exist, we should also check if the report is a money request report and don't push it to the list if it's true.

reportOption.login && !reportOption.isMoneyRequestReport


Additionally, I think it's intentional to have money request report in new chat or search page, but I think it's not expected to have money request report in new group/money request participants page (or maybe there are other page too). So, to further improve this, we can exclude money request report from the list just for some page. We can do same thing like this where we will pass includeMoneyRequest to true for new chat/search page:

const isThread = ReportUtils.isThread(report);
const isChatRoom = ReportUtils.isChatRoom(report);
const isTaskReport = ReportUtils.isTaskReport(report);
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
const logins = report.participants || [];
if (isPolicyExpenseChat && report.isOwnPolicyExpenseChat && !includeOwnedWorkspaceChats) {
return;
}
if (isThread && !includeThreads) {
return;
}
if (isTaskReport && !includeTasks) {
return;
}

Screen.Recording.2023-05-22.at.19.13.03.mov

@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label May 23, 2023
@melvin-bot melvin-bot bot changed the title "Owes you" message shows up in the search page after searching for a contact after settling a money request [$1000] "Owes you" message shows up in the search page after searching for a contact after settling a money request May 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

Job added to Upwork: https://www.upwork.com/jobs/~018b1abad8b1af373d

@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

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

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

melvin-bot bot commented May 23, 2023

Triggered auto assignment to @alex-mechler (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added the Overdue label May 24, 2023
@kevinksullivan
Copy link
Contributor

Hm shouldn't be overdue, this just got to Alex yesterday.

@melvin-bot melvin-bot bot removed the Overdue label May 25, 2023
@alex-mechler
Copy link
Contributor

@Santhosh-Sellavel there is a bunch of proposals in here to review when you get a chance

@Santhosh-Sellavel
Copy link
Collaborator

Yeah, I got that on my list today!

@Santhosh-Sellavel
Copy link
Collaborator

@alex-mechler After looking at proposals, we need to confirm what the issue & what's expected here.

  1. Is showing owes you after settling up the transaction a problem?
  2. We should not show IOU Transactions chat in the Search Page or New Group or New Chat

@alex-mechler
Copy link
Contributor

I'm going to defer to @kevinksullivan on those, I'm not sure what the intended behavior should be, but my thoughts are below

Is showing owes you after settling up the transaction a problem?

I think in the LHN this isnt a problem, since its what was happening in the transaction

We should not show IOU Transactions chat in the Search Page or New Group or New Chat

I think this is correct, or at least we should show them in addition to the user. We should still be showing the User who was entered

@kevinksullivan
Copy link
Contributor

Putting in slack to make sure I understand what we're discussing

https://expensify.slack.com/archives/C049HHMV9SM/p1685124620154599?thread_ts=1684400092.434069&cid=C049HHMV9SM

@kevinksullivan
Copy link
Contributor

sorry for the delay, but this is not reproducible and was already fixed.

https://expensify.slack.com/archives/C049HHMV9SM/p1685126944940099?thread_ts=1684400092.434069&cid=C049HHMV9SM

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. Daily KSv2 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
Projects
None yet
Development

No branches or pull requests

7 participants