Skip to content

[$500] Expense - System message for paid expense shows payer, while the copied content is workspace #33819

Closed

Description

@lanitochka17

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

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 1, 2024
  2. melvin-bot commented on Jan 1, 2024

    @melvin-bot
  3. 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[/+] on Jan 1, 2024
  4. melvin-bot commented on Jan 1, 2024

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 1, 2024
  6. melvin-bot commented on Jan 1, 2024

    @melvin-bot

    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
  7. melvin-bot commented on Jan 1, 2024

    @melvin-bot

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

  8. rrrshtt commented on Jan 1, 2024

    @rrrshtt

    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)

  9. gijoe0295 commented on Jan 1, 2024

    @gijoe0295
    Contributor

    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

  10. dukenv0307 commented on Jan 2, 2024

    @dukenv0307
    Contributor

    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.

  11. sakluger commented on Jan 2, 2024

    @sakluger
    Contributor

    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

  12. 78 remaining items

  13. DylanDylann commented on Feb 15, 2024

    @DylanDylann
    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

  14. trjExpensify commented on Feb 15, 2024

    @trjExpensify
    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? 😂 👀

  15. melvin-bot commented on Feb 20, 2024

    @melvin-bot

    ⚠️ 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.

  16. melvin-bot commented on Feb 20, 2024

    @melvin-bot

    ⚠️ 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.

  17. flodnv commented on Feb 20, 2024

    @flodnv
    Contributor

    We are reverting the PR: #36932

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

  18. dukenv0307 commented on Feb 21, 2024

    @dukenv0307
    Contributor

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

  19. srikarparsi commented on Feb 21, 2024

    @srikarparsi
    Contributor

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

  20. DylanDylann commented on Mar 11, 2024

    @DylanDylann
    Contributor

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

  21. DylanDylann commented on Mar 14, 2024

    @DylanDylann
    Contributor

    @sakluger Bump this comment

    cc @srikarparsi

  22. sakluger commented on Mar 18, 2024

    @sakluger
    Contributor

    Sorry! All paid out now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions