Skip to content

[Due for payment 2025-05-28] [Due for payment 2025-05-23] [$250] LHN - When paying someone, chat preview shows "You" and also user name before payment info. #59566

Closed

Description

@vincdargento

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: 9.1.22-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): ibellicotest+484@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome / Windows 10 - Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Tap on FAB and select "Start Chat"
  3. Select an user to start a chat with.
  4. Once redirected to the new chat, tap on the "+" button.
  5. Select the "Pay" option.
  6. Add an amount and complete the payment creation flow.
  7. Return to LHN.
  8. Check the message displayed on chat preview.

Expected Result:

After sending a payment to another user, chat preview on LHN, should only display the name of the user who sent the payment, before the amount information.

Actual Result:

After sending a payment to another user, chat preview on LHN shows "You" and also the name of the user before the payment information.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021909271368184447116
  • Upwork Job ID: 1909271368184447116
  • Last Price Increase: 2025-04-07
  • Automatic offers:
    • suneox | Reviewer | 106911925
    • thelullabyy | Contributor | 106911926
Issue OwnerCurrent Issue Owner: @lydiabarclay

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 2, 2025
  2. melvin-bot commented on Apr 2, 2025

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. samranahm commented on Apr 2, 2025

    @samranahm
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-02 20:19:52 UTC.

    Proposal

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

    LHN - When paying someone, chat preview shows "You" and also user name before payment info.

    What is the root cause of that problem?

    This is causing due to

    } else {
    result.alternateText = lastActorDisplayName
    ? `${lastActorDisplayName}: ${formatReportLastMessageText(Parser.htmlToText(lastMessageText)) || formattedLogin}`

    That cause to have the "You" as well as payer name in alternate text
    Because we don't have action type lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW in getOptionData function

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

    We should add add lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW check here

    and update this logic

    if (isDM(report) && lastActorDisplayName !== translateLocal('common.you')) {

    like this

            if (isDM(report) && (lastActorDisplayName !== translateLocal('common.you') || lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW)) {

    This will ensure we only have payer name in alternateText instead of You:

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    If we want to keep the You and remove the payer name here

    return translateLocal(translatePhraseKey, {amount: formattedAmount, payer: payerDisplayName ?? ''});

    we pass the payer for all keys here, instead we can check if the key is iou.payerPaidAmount then pass the empty string

    update the logic like this

    const payer = isReportPreviewAction(originalReportAction) && isDM(parentReport) && translatePhraseKey === 'iou.payerPaidAmount' ? '' : payerDisplayName;
    
    return translateLocal(translatePhraseKey, {amount: formattedAmount, payer: payer}); 

    This will keep the LastActorDisplayName You but remove payerName from alternate text
    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. samranahm commented on Apr 2, 2025

    @samranahm
    Contributor
  5. thelullabyy commented on Apr 3, 2025

    @thelullabyy
    Contributor

    Proposal

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

    • After sending a payment to another user, chat preview on LHN shows "You" and also the name of the user before the payment information.

    What is the root cause of that problem?

    • As noted in this PR comment, in the context of DMs, we should only display the sender’s name in the preview if the sender is You. For example:
    You: Lorem Ipsum is simply dummy text
    
    • This behavior is already handled in the logic here:

    } else {
    result.alternateText = lastActorDisplayName
    ? `${lastActorDisplayName}: ${formatReportLastMessageText(Parser.htmlToText(lastMessageText)) || formattedLogin}`
    : formatReportLastMessageText(Parser.htmlToText(lastMessageText)) || formattedLogin;
    }

    • However, for messages of type REPORTPREVIEW, there is separate logic that adds the payer's name to the message:

    return translateLocal(translatePhraseKey, {amount: formattedAmount, payer: payerDisplayName ?? ''});

    • As a result, if the current user—say, Bob—paid an expense, the chat preview ends up redundantly showing:
    You: Bob paid 12$
    

    This creates confusion by repeating the sender’s identity when it's already implied by the "You" prefix.

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

    • We should adjust the logic so that in DMs, when the current user is the payer, the preview displays:
    You: paid 12$
    

    instead of:

    You: Bob paid 12$
    
    • To achieve this, we can update the logic in the following function:

    return translateLocal(translatePhraseKey, {amount: formattedAmount, payer: payerDisplayName ?? ''});

    Here’s the proposed update:

    const parentReport = getReport(report?.parentReportID, allReports);
    const payerText = isDM(parentReport) && translatePhraseKey === 'iou.payerPaidAmount' ? '' : payerDisplayName;
    return translateLocal(translatePhraseKey, {amount: formattedAmount, payer: payerText});
    • Explanation: This change ensures that if the message is in a DM and the translation key is iou.payerPaidAmount (used for payment previews), we omit the payer’s name. This avoids redundant information when the sender is the current user. The "You: " prefix is already correctly handled in SidebarUtils.ts.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    • Render SidebarLinks for a DM conversation where the most recent message is of type REPORTPREVIEW, and verify that:
      • If the current user sent the payment, the preview shows You: paid 12$
      • If another user sent the payment, the preview shows paid 12$

    What alternative solutions did you explore? (Optional)

  6. lydiabarclay commented on Apr 3, 2025

    @lydiabarclay
    Contributor

    Same here:

    Image
  7. lydiabarclay commented on Apr 3, 2025

    @lydiabarclay
    Contributor

    @dannymcclain is this expected behavior or a bug? unsure

  8. samranahm commented on Apr 4, 2025

    @samranahm
    Contributor

    @lydiabarclay It will be fixed in My proposal, now we just need to make sure what we want to keep.

    • Option one (Proposed solution)
    Lydia paid $65.00 //current user
    Lydia paid $65.00 //other user
    
    • Option two (alternate solution)
     You: paid $65.00 
     Lydia: paid $65.00
    
  9. dannymcclain commented on Apr 4, 2025

    @dannymcclain
    Contributor

    Yeah what we currently have is definitely not what we want. @Expensify/design what do you think about these options?

    I think I lean towards the second option

    You: paid $65.00 
    Lydia: paid $65.00
    

    because that feels the most consistent with everything else? But let's get some confirmation before proceeding.

  10. thelullabyy commented on Apr 4, 2025

    @thelullabyy
    Contributor

    @dannymcclain FYI, we have a long discussion about the expected behavior #58271 (comment):

    No need to use the sender name in DMs unless it is You

  11. samranahm commented on Apr 6, 2025

    @samranahm
    Contributor

    @dannymcclain FYI, we have a long discussion about the expected behavior #58271 (comment):

    No need to use the sender name in DMs unless it is You

    That sounds weird

    You: paid $65.00 
    paid $65.00
    

    So, this is best option here as suggested by @dannymcclain

    You: paid $65.00 
    Lydia: paid $65.00
    
  12. dubielzyk-expensify commented on Apr 7, 2025

    @dubielzyk-expensify
    Contributor

    Agree with @dannymcclain that the option feels most consistent with the rest 👍

  13. 98 remaining items

  14. lydiabarclay commented on May 16, 2025

    @lydiabarclay
    Contributor

    Beginning new 7-day count before payment due to regression

  15. changed the title [-][Due for payment 2025-05-05] [$250] LHN - When paying someone, chat preview shows "You" and also user name before payment info.[/-] [+][Due for payment 2025-05-23] [$250] LHN - When paying someone, chat preview shows "You" and also user name before payment info.[/+] on May 16, 2025
  16. thelullabyy commented on May 19, 2025

    @thelullabyy
    Contributor

    @suneox Thanks for helping me create PR

  17. mountiny commented on May 19, 2025

    @mountiny
    Contributor

    Thanks

  18. changed the title [-][Due for payment 2025-05-23] [$250] LHN - When paying someone, chat preview shows "You" and also user name before payment info.[/-] [+][Due for payment 2025-05-28] [Due for payment 2025-05-23] [$250] LHN - When paying someone, chat preview shows "You" and also user name before payment info.[/+] on May 21, 2025
  19. melvin-bot commented on May 21, 2025

    @melvin-bot

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

  20. melvin-bot commented on May 21, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.47-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 2025-05-28. 🎊

    For reference, here are some details about the assignees on this issue:

  21. melvin-bot commented on May 21, 2025

    @melvin-bot

    @suneox @lydiabarclay @suneox The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  22. suneox commented on May 27, 2025

    @suneox
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
  23. lydiabarclay commented on May 28, 2025

    @lydiabarclay
    Contributor

    Payment Summary

    *reduced by 50% due to regression

    Contributor: @suneox paid $125 via Upwork
    Contributor: @thelullabyy paid $125 via Upwork

    ✅ Regression test filed

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions