Skip to content

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

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

Open
4 of 8 tasks
vincdargento opened this issue Apr 2, 2025 · 73 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@vincdargento
Copy link

vincdargento commented Apr 2, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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): [email protected]
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: @suneox
@vincdargento vincdargento added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Apr 2, 2025
Copy link

melvin-bot bot commented Apr 2, 2025

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.

@samranahm
Copy link
Contributor

samranahm commented Apr 2, 2025

🚨 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.

@samranahm
Copy link
Contributor

Proposal updated

@thelullabyy
Copy link
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)

@lydiabarclay
Copy link

Same here:

Image

@lydiabarclay
Copy link

@dannymcclain is this expected behavior or a bug? unsure

@samranahm
Copy link
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

@dannymcclain
Copy link
Contributor

dannymcclain commented Apr 4, 2025

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.

@thelullabyy
Copy link
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

@samranahm
Copy link
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

@melvin-bot melvin-bot bot added the Overdue label Apr 6, 2025
@dubielzyk-expensify
Copy link
Contributor

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

@shawnborton
Copy link
Contributor

Hmm for DMs, we never show the other user's name before their message preview So I actually think this is the most consistent personally:

  • If you are viewing a DM's preview line, and you were the one that paid: You: paid $65.00
  • If you are viewing a DM's preview line, and the other party paid: paid $65.00

Because you would alway see the other party's name above the preview line (or to the left in focus mode) so I think it totally works fine.

@thelullabyy
Copy link
Contributor

Yes, that's what you mentioned here:

Image

@shawnborton
Copy link
Contributor

Love to see my consistency 🤣

@dubielzyk-expensify
Copy link
Contributor

Haha.

Yeah, you make a good point. I think I thought about it also from the Workspace chat perspective:

Image

I don't feel super strongly and while we have rules here I also feel like the consistency isn't always 100% applicable. Happy to defer to you here

@shawnborton
Copy link
Contributor

shawnborton commented Apr 7, 2025

Well for a workspace chat, it's technically a room, and in rooms, we always prepend the sender name in the preview.

For a paid action, that actually comes from an individual and not the workspace. So let's say Jason is a payer in my workspace chat. I would expect the preview to look something like:

Shawn Borton's expenses
Jason: paid $10.00

@thelullabyy
Copy link
Contributor

@shawnborton @dubielzyk-expensify FYI, the scope of this issue is about the 1:1 DM

@shawnborton
Copy link
Contributor

Yup, understood. Just trying to explain how the "system" works to help us better understand our decisions about the DM.

@dubielzyk-expensify
Copy link
Contributor

Yeah, fair point 👍 Happy to go with that

Copy link

melvin-bot bot commented Apr 7, 2025

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

@dannymcclain
Copy link
Contributor

Agree with everything above! I was also not in the 1:1 mindset when commenting earlier, so I agree that Shawn's suggestion is the right way to go here.

@samranahm
Copy link
Contributor

Yeah, fair point 👍 Happy to go with that

@shawnborton @dubielzyk-expensify Yeah, that was pretty straightforward, but i was missing 1:1

poc.mp4

cc @dannymcclain

@lydiabarclay lydiabarclay added the External Added to denote the issue can be worked on by a contributor label Apr 7, 2025
@melvin-bot melvin-bot bot changed the title LHN - When paying someone, chat preview shows "You" and also user name before payment info. [$250] LHN - When paying someone, chat preview shows "You" and also user name before payment info. Apr 7, 2025
Copy link

melvin-bot bot commented Apr 7, 2025

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

@suneox
Copy link
Contributor

suneox commented May 2, 2025

@shubham1206agra could you please confirm - did #60267 cause a regression?

Actually, we didn’t realize that PR was merged after our PR was approved and waiting to be merge. I think we need to rework this one based on the new logic from #59778

@suneox
Copy link
Contributor

suneox commented May 2, 2025

@shubham1206agra @daledah Why don't we display the last actor display name if the last action is a report preview action?

@thelullabyy The new condition makes the logic consistent with OptionsListUtils. Could you please provide an update for this one?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 5, 2025
@thelullabyy

This comment has been minimized.

@thelullabyy
Copy link
Contributor

@suneox @mountiny

After this change:

lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW

the actual result in #59566 has changed.

Previously, the chat preview on the LHN after sending a payment showed:
"You: username paid X$"

However, following that PR (which removed "You") and our PR (which removed the "username"), the current behavior is:
"paid X$"

Since both PRs were merged simultaneously, the final output differs from the original expectation. I’d like to clarify the next steps here. Using "You: username paid X$" as the reference, there are a few paths forward:

  1. If we still want to keep the "You" — the fix should be updated by the author of that PR, since it was the one that removed "You".
  2. If we don’t want "You", but want to keep the username — then we should revert our PR.
  3. If we don’t want to keep either "You" or "username" — then the current result is correct, and no further changes are needed.

Let me know your thoughts on which direction we should take.

@shubham1206agra
Copy link
Contributor

I believe 2nd option is correct.

@suneox
Copy link
Contributor

suneox commented May 6, 2025

Since both PRs were merged simultaneously, the final output differs from the original expectation.

I agree that the issue was caused by the PRs working simultaneously, so we have to find another solution to fix the issue

Option 2: would go against this comment.

Option 3: doesn't make sense because of this comment.

@shubham1206agra
Copy link
Contributor

@shawnborton Can you help them here please?

@shawnborton
Copy link
Contributor

Part of me thinks for the IOU case, we should always just show the full IOU title... like Shawn paid $X.XX

Then we always retain the existing logic for when we should or shouldn't show the You in the preview line. Does that make sense?

@melvin-bot melvin-bot bot added the Overdue label May 7, 2025
@suneox
Copy link
Contributor

suneox commented May 7, 2025

Part of me thinks for the IOU case, we should always just show the full IOU title... like Shawn paid $X.XX

Then we always retain the existing logic for when we should or shouldn't show the You in the preview line. Does that make sense?

I agree with this. The next step we can revert our PR and keep the current logic, after removing the last actor name in the IOU case from this PR

cc: @mountiny

@lydiabarclay
Copy link

@suneox will you just confirm here once the PR is fully reverted so that I may begin another 7-day count before payment?

Copy link

melvin-bot bot commented May 8, 2025

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

Copy link

melvin-bot bot commented May 12, 2025

@suneox 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@suneox
Copy link
Contributor

suneox commented May 12, 2025

We're still waiting for the PR to be reverted.
@mountiny Will the internal team revert the PR, or will the owner revert it?

cc: @thelullabyy
git revert -m 1 905fad7

@melvin-bot melvin-bot bot removed the Overdue label May 12, 2025
@mountiny
Copy link
Contributor

Sorry, was ooo, ok lets revert the PR, please @thelullabyy or @suneox do so

@lydiabarclay
Copy link

@thelullabyy @suneox can you please confirm once this is reverted?

@melvin-bot melvin-bot bot added the Overdue label May 15, 2025
@suneox
Copy link
Contributor

suneox commented May 16, 2025

@thelullabyy @suneox can you please confirm once this is reverted?

Not yet, @thelullabyy could you help create a revert PR?

@lydiabarclay
Copy link

Beginning new 7-day count before payment due to regression

@lydiabarclay lydiabarclay 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. May 16, 2025
@thelullabyy
Copy link
Contributor

@suneox Thanks for helping me create PR

@mountiny
Copy link
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: No status
Development

No branches or pull requests