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

[$500] Request Money - Offline Receipt & Distance request to worspace don't show requestor name #28554

Closed
6 tasks done
lanitochka17 opened this issue Sep 30, 2023 · 18 comments
Closed
6 tasks done
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

@lanitochka17
Copy link

lanitochka17 commented Sep 30, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go offline
  2. Go to a chat with any workspace with which you don't have any IOU actions yes
  3. Click "+" -> Request Money
  4. Place a Receipt (or Distance) request
  5. See the chat with newly created IOU report preview

Expected Result:

The header of the report should show "{Workspace} & {user}"

Actual Result:

The header shows only "{Workspace} &"

Workaround:

Unknown

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.75-3

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

android_web.mov
android.mov
iOS.mp4
desktop.mov
RPReplay_Final1696025471.MP4
web.mov
Recording.119.mp4

Expensify/Expensify Issue URL:

Issue reported by: @paultsimura

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696025357358249

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0125018631320cc910
  • Upwork Job ID: 1708258808024285184
  • Last Price Increase: 2023-10-07
@lanitochka17 lanitochka17 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 Sep 30, 2023
@melvin-bot melvin-bot bot changed the title Request Money - Offline Receipt & Distance request to worspace don't show requestor name [$500] Request Money - Offline Receipt & Distance request to worspace don't show requestor name Sep 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0125018631320cc910

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

melvin-bot bot commented Sep 30, 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

@melvin-bot
Copy link

melvin-bot bot commented Sep 30, 2023

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

@allroundexperts
Copy link
Contributor

allroundexperts commented Sep 30, 2023

Proposal

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

Offline Receipt and Distance request to workspace do not show requester name

What is the root cause of that problem?

The root cause of the issue is that we're creating the optimistic expense report here without adding a managerID. This can be seen here.

When the expense report does not have a manager account id, the value of secondaryAccountId here becomes undefined. This causes the displayName of the report action item to be empty.

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

We should add a new parameter to the buildOptimisticExpenseReport function called payerAccountID and use it to set managerID value here.

In here, we'll pass payerAccountID as the new parameter to the buildOptimisticExpenseReport function.

However, for the case where the money is requested from a workspace, the payerAccountID as defined here has a value of NAN. This is because a workspace does not have a account id directly. Rather, it has a ownerAccountId. As such, we should also change this to:

    const payerAccountID = Number(participant.accountID || participant.ownerAccountID);

Instead of changing the payerAccountID variable, we can also pass Number(participant.accountID || participant.ownerAccountID) directly to the buildOptimisticExpenseReport function.

What alternative solutions did you explore? (Optional)

None

@paultsimura
Copy link
Contributor

paultsimura commented Oct 1, 2023

Proposal

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

When offline, the Receipt money request in a workspace doesn't show user name in the header.

What is the root cause of that problem?

The root cause lies here:

const secondaryAccountId = props.iouReport.ownerAccountID === actorAccountID ? props.iouReport.managerID : props.iouReport.ownerAccountID;

We are trying to show user details by iouReport.managerID, but the optimistic Expense reports don't have the managerID set (as it will be populated with the policy's owner ID later):

App/src/libs/ReportUtils.js

Lines 2116 to 2131 in 289411f

return {
reportID: generateReportID(),
chatReportID,
policyID,
type: CONST.REPORT.TYPE.EXPENSE,
ownerAccountID: payeeAccountID,
hasOutstandingIOU: true,
currency: outputCurrency,
// We don't translate reportName because the server response is always in English
reportName: `${policyName} owes ${formattedTotal}`,
state: CONST.REPORT.STATE.SUBMITTED,
stateNum: CONST.REPORT.STATE_NUM.PROCESSING,
total: storedTotal,
parentReportID: chatReportID,
};

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

This change was introduced recently in order to avoid name duplication (explained in the comment). But if the report is an expense report, the first actor's name is always a workspace name:

if (isWorkspaceActor) {
displayName = ReportUtils.getPolicyName(props.report);
actorHint = displayName;
avatarSource = ReportUtils.getWorkspaceAvatar(props.report);

So we can (and should) exclude the expense report from this managerID check and use iouReport.ownerAccountID :

const secondaryAccountId = !isWorkspaceActor && props.iouReport.ownerAccountID === actorAccountID ? props.iouReport.managerID : props.iouReport.ownerAccountID

What alternative solutions did you explore? (Optional)

Mu initial idea was to set the expense report's managerID optimistically, but in case of policy expense reports, we shouldn't use the iouReport.managerID while showing the report preview header. Why? Because it always will be the policy owner. So we can run into a situation when User A requested money from User B's workspace. And this header will show: "UserB's Workspace & User B" instead of "UserB's Workspace & User A"

Proof (here I've requested money as "qa1" user with the orange avatar. And the "New User is the owner of the "Another Workspace"):

image

@paultsimura
Copy link
Contributor

@lanitochka17 don't I have the right of posting the first proposal in the thread of a bug if I reported it originally?

It was posted here: https://expensify.slack.com/archives/C049HHMV9SM/p1696027752529129?thread_ts=1696025357.358249&channel=C049HHMV9SM&message_ts=1696027752.529129

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Oct 1, 2023

@paultsimura I think @lanitochka17 forgot to post your proposal from Slack. if you have a proposal in Slack first you would be considered here. but in Slack, only bug reporters post the proposal on slack.

@paultsimura
Copy link
Contributor

@pradeepmdk thanks, I just wanted to clarify this. No offense😌

@allroundexperts
Copy link
Contributor

Mu initial idea was to set the expense report's managerID optimistically, but in case of policy expense reports, we shouldn't use the iouReport.managerID while showing the report preview header. Why? Because it always will be the policy owner.

Hi @paultsimura. Thanks for your elaborate explanation. I think for the case you mentioned above, this condition props.iouReport.ownerAccountID === actorAccountID would not be true. As such, the secondary account id would be the iou report's owner (which is the user requesting money).

I might be wrong here but I'm pretty sure that I tested the case you mentioned above and found it working fine. If not, then this becomes a regression from #27912. Since #27912 is still on a 7 day hold, the original author would be fixing this.

@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

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

@puneetlath
Copy link
Contributor

@situchan thoughts on the proposals/discussion?

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2023
@neil-marcellini
Copy link
Contributor

Never mind, this isn't specific to distance requests. It's also no longer reproducible on staging. I verified it with distance requests too. We can close this.

Screen.Recording.2023-10-05.at.2.45.38.PM.mov

@situchan
Copy link
Contributor

situchan commented Oct 5, 2023

I am also not able to reproduce. We can close this

Oops, I just reproduced

Screenshot 2023-10-06 at 4 18 03 AM

@paultsimura
Copy link
Contributor

This was indeed fixed by #28350.

@melvin-bot
Copy link

melvin-bot bot commented Oct 7, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

@puneetlath, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@puneetlath
Copy link
Contributor

Closing this out since the bug no longer exists.

@melvin-bot melvin-bot bot removed the Overdue label Oct 9, 2023
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