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] Expense - System message for paid expense shows payer, while the copied content is workspace #33819

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

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 1, 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.20-2
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. [Member] Request money in workspace chat
  2. [Admin] Pay the request
  3. [Member] Click on the expense preview to go to expense report
  4. [Member] Right click on the paid system message > Copy to clipboard
  5. [Member] Paste the content
    Note that

Expected Result:

  1. The system message should always start with the action, not the actor, regardless of who is viewing the chat. So the system message should read paid $10 rather than John paid $10 or John's Workspace paid $10.
  2. When a user copies a system message, we should copy only what is printed, rather than adding the actor (so we should copy paid $10 instead of copying John Doe paid $10)

Actual Result:

  1. Depending on who is viewing the report, the system message shows either paid amount elsewhere or [admin] paid amount elsewhere.
  2. When the user copies and pastes the system message, it shows something different from what was printed originally (it shows [Workspace name] paid amount elsewhere.

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

Bug6329831_1704112491311.bandicam_2023-12-30_12-33-56-983.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015bfbfa9935f7c034
  • Upwork Job ID: 1741887749877055488
  • Last Price Increase: 2024-01-22
  • Automatic offers:
    • DylanDylann | Reviewer | 28147572
    • dukenv0307 | Contributor | 28147573
@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 Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

Job added to Upwork: https://www.upwork.com/jobs/~015bfbfa9935f7c034

@melvin-bot melvin-bot bot changed the title Expense - System message for paid expense shows payer, while the copied content is workspace [$500] Expense - System message for paid expense shows payer, while the copied content is workspace Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

Triggered auto assignment to @sakluger (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 Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

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 Jan 1, 2024

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

@rrrshtt
Copy link

rrrshtt commented Jan 1, 2024

Proposal

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

Clipboard information is different from what you see in chat after the expense paid action.

What is the root cause of that problem?

const payerName = isExpenseReport(iouReport) ? getPolicyName(iouReport) : getDisplayNameForParticipant(iouReport?.managerID, true);

const payerName = isExpenseReport(report) ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport);

As you can see, in these two lines, we choose payerName for information in the clipboard and also for showing in the system message.

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

App/src/libs/ReportUtils.ts

Lines 4124 to 4133 in cafe831

switch (originalMessage.paymentType) {
case CONST.IOU.PAYMENT_TYPE.ELSEWHERE:
translationKey = 'iou.paidElsewhereWithAmount';
break;
case CONST.IOU.PAYMENT_TYPE.EXPENSIFY:
case CONST.IOU.PAYMENT_TYPE.VBBA:
translationKey = 'iou.paidWithExpensifyWithAmount';
break;
default:
translationKey = 'iou.payerPaidAmount';

Here are three different options with "PayerName": paidElsewhereWithAmount, paidWithExpensifyWithAmount, payerPaidAmount. Simply remove PayerName in their translation function, and then remove payerName on every usage of these functions (they are also used in another function called getReportPreviewMessage()).

I think there is a reason for a different function. At first glance, I won't remove the function getIOUReportActionDisplayMessage().

What alternative solutions did you explore? (Optional)

@gijoe0295
Copy link
Contributor

gijoe0295 commented Jan 1, 2024

Proposal

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

System message for paid expense shows payer, while the copied content is workspace

What is the root cause of that problem?

We show policy name instead of payer display name in case of policy:

const payerName = isExpenseReport(iouReport) ? getPolicyName(iouReport) : getDisplayNameForParticipant(iouReport?.managerID, true);

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

The problem here is about the inconsistency between the system message and the copied content. According to this issue:

The reportAction added to the iouReport/expenseReport comes from the reimburser who paid

We no longer need to show workspace name for reimbursement messages because it will always show the actual payer name. And thus we should remove the isExpenseReport check and always show display name:

const payerName = isExpenseReport(iouReport) ? getPolicyName(iouReport) : getDisplayNameForParticipant(iouReport?.managerID, true);

The check (i.e. show workspace or payer name) is now only necessary for LHN or report preview.

What alternative solutions did you explore? (Optional)

NA

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 2, 2024

Proposal

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

The system message shows paid amount elsewhere, but the copied content is paid amount elsewhere

What is the root cause of that problem?

  1. In getReportPreviewMessage function, we show the payment type for the case request is settled

let translatePhraseKey: TranslationPaths = 'iou.paidElsewhereWithAmount';

  1. When we click on copy to clipboard, we use getIOUReportActionDisplayMessage function to get the display message and in this function, we will display the workspace name instead of the actor name.

const payerName = isExpenseReport(iouReport) ? getPolicyName(iouReport) : getDisplayNameForParticipant(iouReport?.managerID, true);

but when we display this action, we use getReportPreviewMessage function to get iouMessage.

iouMessage = ReportUtils.getReportPreviewMessage(ReportUtils.getReport(iouReportID), action);

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

  1. In getReportPreviewMessage, for the settled case we can use iou.payerPaidAmount translation key to not display the payment type of the settle message if we get this message for report preview. We can add an extra param to know whether we get the message for the report preview. We should add an extra prop to know whether we should hide the payerName.

let translatePhraseKey: TranslationPaths = 'iou.paidElsewhereWithAmount';

And then when we get the message here we will pass this param as true to hide the payerName in system paid message.

iouMessage = ReportUtils.getReportPreviewMessage(ReportUtils.getReport(iouReportID), action);

  1. When we click on copy to clipboard, we should copy the same message displayed by using getReportPreviewMessage function in the same way we do here.

const payerName = isExpenseReport(iouReport) ? getPolicyName(iouReport) : getDisplayNameForParticipant(iouReport?.managerID, true);

iouMessage = ReportUtils.getReportPreviewMessage(ReportUtils.getReport(iouReportID), action);

What alternative solutions did you explore? (Optional)

For point 2, we can remove the payerName in getIOUReportActionDisplayMessage function. But I'd like to use getReportPreviewMessage rather than update getIOUReportActionDisplayMessage function because if we make an update in getReportPreviewMessage function, we don't need to update other functions anymore.

@sakluger
Copy link
Contributor

sakluger commented Jan 2, 2024

Something is definitely wrong here, but I'm not sure what the expected behavior is. Should the system message show the admin's name, the workspace's name, or neither? I'm confident that the system message should NOT show the admin's name, but I'm not sure which of the other two it should show.

I asked for the team's feedback in Slack: https://expensify.slack.com/archives/C02MW39LT9N/p1704233160288869

@aim-salam
Copy link

.

@gijoe0295
Copy link
Contributor

@sakluger You can refer to this issue: #30042.

@sakluger
Copy link
Contributor

sakluger commented Jan 4, 2024

I updated the expected behavior and actual behavior. Expected result is now:

  1. The system message should always start with the action, not the actor, regardless of who is viewing the chat. So the system message should read paid $10 rather than John paid $10 or John's Workspace paid $10.
  2. When a user copies a system message, we should copy only what is printed, rather than adding the actor (so we should copy paid $10 instead of copying John Doe paid $10)

@rrrshtt @gijoe0295 @dukenv0307 would you like to update your proposal based on the new expected result?

@dukenv0307
Copy link
Contributor

Updated proposal.

@gijoe0295
Copy link
Contributor

gijoe0295 commented Jan 4, 2024

Updated Proposal

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

System message for paid expense shows payer, while the copied content is workspace

What is the root cause of that problem?

We show policy name instead of payer display name in case of policy:

const payerName = isExpenseReport(iouReport) ? getPolicyName(iouReport) : getDisplayNameForParticipant(iouReport?.managerID, true);

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

Based on the latest expectation:

The system message should always start with the action

There are cases that needs getting rid of actor: here, here, here, and here

I'm not sure the expectation with LHN preview but I'm assuming that LHN preview message should still have actor name. Because getReportPreviewMessage is used for LHN preview as well, we should use the check isForListPreview.

We should copy only what is printed

We should use getReportPreviewDisplay for consistency:

const displayMessage = ReportUtils.getIOUReportActionDisplayMessage(reportAction);

What alternative solutions did you explore? (Optional)

NA

@rrrshtt
Copy link

rrrshtt commented Jan 4, 2024

Proposal

Updated

@sakluger
Copy link
Contributor

sakluger commented Jan 5, 2024

@0xmiroslav hopefully one of the above proposals does the trick! Mind taking a look when you hae a chance?

@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
Copy link

melvin-bot bot commented Jan 8, 2024

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

@0xmiros
Copy link
Contributor

0xmiros commented Jan 8, 2024

reviewing

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 8, 2024
@sakluger
Copy link
Contributor

@0xmiroslav friendly bump.

@melvin-bot melvin-bot bot removed the Overdue label Jan 10, 2024
@0xmiros
Copy link
Contributor

0xmiros commented Jan 12, 2024

updating today

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

melvin-bot bot commented Feb 7, 2024

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

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

melvin-bot bot commented Feb 7, 2024

📣 @DylanDylann 🎉 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 Feb 7, 2024

📣 @dukenv0307 🎉 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 📖

@melvin-bot melvin-bot bot added the Overdue label Feb 9, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Feb 10, 2024
@dukenv0307
Copy link
Contributor

@DylanDylann The PR is ready for review.

@DylanDylann
Copy link
Contributor

@trjExpensify Currently, I see that in some cases the preview message and the message from the "Copy to clipboard" button are different.

Screen.Recording.2024-02-15.at.15.30.42.mov

In the above video:

  • Preview message in LHN: Scan in progress…
  • The message from "Copy to clipboard": requested ₫0

Is this expected? What do you think about displaying The message from "Copy to clipboard" similar to Preview message in LHN

cc @dukenv0307 @srikarparsi

@trjExpensify
Copy link
Contributor

What do you think about displaying The message from "Copy to clipboard" similar to Preview message in LHN

Yeah, I think generally what you copy should be what you see, so let's copy the message being previewed.

P.s why does the receipt thumbnail appear to zoom like that, man? 😂 👀

Copy link

melvin-bot bot commented Feb 20, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

Copy link

melvin-bot bot commented Feb 20, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@flodnv flodnv removed the Reviewing Has a PR in review label Feb 20, 2024
@flodnv
Copy link
Contributor

flodnv commented Feb 20, 2024

We are reverting the PR: #36932

I think a few considerations were missed as part of the planning of this feature request bug.

@dukenv0307
Copy link
Contributor

@flodnv I created a PR to fix the current issue and all related issues here #36993.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Weekly KSv2 labels Feb 21, 2024
@srikarparsi
Copy link
Contributor

srikarparsi commented Feb 21, 2024

Left a comment here, I think it might be better to merge the revert PR first and then focus on fixing this issue after.

@DylanDylann
Copy link
Contributor

@sakluger The PR was deployed to production 2 weeks ago. Please help to process the next step

@DylanDylann
Copy link
Contributor

@sakluger Bump this comment

cc @srikarparsi

@sakluger
Copy link
Contributor

Sorry! All paid out now.

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. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests