Skip to content

[Due for payment 2025-04-14] [$250] Search - 1:1 DM preview in the search router does not display "You" as the sender #58939

Closed

Description

@mitarachim

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.17-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: Exp
Email or phone of affected tester (no customers): applausetester+kok1@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.3 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to workspace chat.
  4. Send a message.
  5. Open a DM.
  6. Send a message.
  7. Right click on the DM message > Reply in thread.
  8. Send a reply in thread.
  9. Note that LHN preview for three reports above show the sender "You".
  10. Open search router.

Expected Result:

All the report previews in the search router will show the sender "You".

Actual Result:

Only the DM message in Step 6 does not show the sender "You" in the search router preview.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6778790_1742619606926.20250322_125616.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021904880454325354367
  • Upwork Job ID: 1904880454325354367
  • Last Price Increase: 2025-03-26
  • Automatic offers:
    • nkdengineer | Contributor | 106675694
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @joekaufmanexpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @joekaufmanexpensify (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. mitarachim commented on Mar 22, 2025

    @mitarachim
    Author

    i could see little bit different behavior in Prod while reproduce this issue .
    DM and message from replay in thread not show the sender You

    Screen.Recording.2025-03-22.at.12.11.38.PM.mp4
  4. daledah commented on Mar 22, 2025

    @daledah
    Contributor

    Proposal

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

    Only the DM message in Step 6 does not show the sender "You" in the search router preview.

    What is the root cause of that problem?

    For 1:1 chat, we don't want to include the current user as a participant

    App/src/libs/ReportUtils.ts

    Lines 2594 to 2596 in 8deddfa

    // For 1:1 chat, we don't want to include the current user as a participant in order to not mark 1:1 chats as having multiple participants
    // For system chat, we want to display Expensify as the only participant
    const shouldExcludeCurrentUser = isOneOnOneChat(report) || isSystemChat(report) || shouldForceExcludeCurrentUser;

    So personalDetailMap here will not have current user

    const lastActorDetails = report.lastActorAccountID ? personalDetailMap[report.lastActorAccountID] : null;
    const lastActorDisplayName = getLastActorDisplayName(lastActorDetails);

    It leads to lastActorDisplayName will be undefined

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

    We can add the new variable to check if it is from the Search Router, we will consider the current user as a participant and pass it as true in OptionsListContextProvider component

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

    None

    What alternative solutions did you explore? (Optional)

    Or we can check if the parent of the report is 1:1 chat, we should not consider the current user as a participant to make it consistent

  5. bernhardoj commented on Mar 24, 2025

    @bernhardoj
    Contributor

    Proposal

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

    In LHN, last message for DM shows You:, but in search, You: doesn't show.

    What is the root cause of that problem?

    We get the sender name by getting it from personalDetailMap.

    const lastActorDetails = report.lastActorAccountID ? personalDetailMap[report.lastActorAccountID] : null;
    const lastActorDisplayName = getLastActorDisplayName(lastActorDetails);

    personalDetailMap only contains the user from accountIDs.

    const personalDetailMap = getPersonalDetailsForAccountIDs(accountIDs, personalDetails);

    However, the accountID from getParticipantsAccountIDsForDisplay doesn't include the current user.

    const accountIDs = getParticipantsAccountIDsForDisplay(report);

    App/src/libs/ReportUtils.ts

    Lines 2594 to 2596 in 4750e38

    // For 1:1 chat, we don't want to include the current user as a participant in order to not mark 1:1 chats as having multiple participants
    // For system chat, we want to display Expensify as the only participant
    const shouldExcludeCurrentUser = isOneOnOneChat(report) || isSystemChat(report) || shouldForceExcludeCurrentUser;

    So, when retrieving the current user details, we get nothing.

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

    Instead of using personalDetailMap, we can just use personalDetails directly.

    const lastActorDetails = report.lastActorAccountID ? personalDetailMap[report.lastActorAccountID] : null;

    const lastActorDetails = report.lastActorAccountID ? personalDetails?.[report.lastActorAccountID] ?? {} : null;
    

    Then, we can also apply this same logic from LHN so that in DM, the other user name won't show.

    if (isDM(report) && lastActorDisplayName !== translateLocal('common.you')) {
    result.alternateText = formatReportLastMessageText(Parser.htmlToText(lastMessageText)) || formattedLogin;

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

    We can create a test for createOption by passing a DM report and other params and verify that when the last actor is the current user, You is included for the alternate text.

    What alternative solutions did you explore? (Optional)

    Don't show You in DM

  6. joekaufmanexpensify commented on Mar 24, 2025

    @joekaufmanexpensify
    Contributor

    Not overdue. Triaging today.

  7. joekaufmanexpensify commented on Mar 25, 2025

    @joekaufmanexpensify
    Contributor

    This is pretty minor. I see the argument that it'd be nice to have these be consistent, but I am not convinced that this really has any user impact. This has probably been this way for a long time without anyone raising any issues. I recommend we wait and see if any actual customers raise this before changing the behavior.

  8. bernhardoj commented on Mar 26, 2025

    @bernhardoj
    Contributor

    This has probably been this way for a long time without anyone raising any issues

    @joekaufmanexpensify This is actually pretty new, added in #57038.

    cc: @shawnborton

  9. shawnborton commented on Mar 26, 2025

    @shawnborton
    Contributor

    It sounds like maybe we forgot to add this to the router. @nkdengineer can you please submit a follow up PR to make sure the message previews in the router are identical to message previews in the LHN?

  10. joekaufmanexpensify commented on Mar 26, 2025

    @joekaufmanexpensify
    Contributor

    Ah, I didn't realize this was just added. Fixing makes sense then.

  11. 37 remaining items

  12. joekaufmanexpensify commented on Apr 14, 2025

    @joekaufmanexpensify
    Contributor
  13. allroundexperts commented on Apr 14, 2025

    @allroundexperts
    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:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: This was a follow up from the previous PR and the author knows about it.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    • N/A

    Test:

    1. Open a DM chat
    2. Send a message
    3. Click on the search icon

    Verify that You is displayed as the sender

    Do we agree 👍 or 👎

  14. joekaufmanexpensify commented on Apr 15, 2025

    @joekaufmanexpensify
    Contributor
  15. joekaufmanexpensify commented on Apr 15, 2025

    @joekaufmanexpensify
    Contributor

    Checklist is done.

  16. joekaufmanexpensify commented on Apr 15, 2025

    @joekaufmanexpensify
    Contributor

    @nkdengineer @allroundexperts I don't think any payment is due here, because we should have included this in #58271 and this was handled as a follow up. Let me know if either of you disagree with that!

  17. joekaufmanexpensify commented on Apr 15, 2025

    @joekaufmanexpensify
    Contributor

    @nkdengineer I went ahead and ended the upwork contract without payment and closed the upwork job.

  18. joekaufmanexpensify commented on Apr 15, 2025

    @joekaufmanexpensify
    Contributor

    Closing this for now, as we should be all set!

  19. allroundexperts commented on Apr 15, 2025

    @allroundexperts
    Contributor

    @joekaufmanexpensify The original ticket mentioned the changes for LHN only. I think this particular case was not defined initially and should be treated as a follow up instead.

  20. JmillsExpensify commented on Jun 17, 2025

    @JmillsExpensify
    Contributor

    @joekaufmanexpensify thoughts on that last comment?

  21. nkdengineer commented on Jun 18, 2025

    @nkdengineer
    Contributor
    1. Navigate to admin room of a workspace
    2. Send a message
    3. Observe the LHN

    @joekaufmanexpensify I agree with @allroundexperts opinion here. I think we should consider this issue as a follow up issue

  22. joekaufmanexpensify commented on Jun 27, 2025

    @joekaufmanexpensify
    Contributor

    Thanks for flagging this. I missed this originally because the GH was closed.

  23. joekaufmanexpensify commented on Jun 27, 2025

    @joekaufmanexpensify
    Contributor

    I definitely appreciate the sentiment that you both are sharing. However, I think the intent of the initial bug report was that we would fix this everywhere, not just in one place. The initial bug report did not mention fixing it only on the LHN, it just mentioned message previews. The LHN piece was added when it got translated to the GH issue.

    Philosophically, if we are experiencing a bug in multiple places, we should always strive to fix it everywhere even if a bug report only mentions one of those IMO. I see the follow up PR was a one line change too, so feels pretty reasonable to me that it would be covered in the initial bounty for the bug.

    Happy to get a second opinion internally from the rest of our team if you would like me too, just LMK. But otherwise, I think we'd leave this as is.

  24. nkdengineer commented on Jul 8, 2025

    @nkdengineer
    Contributor

    @joekaufmanexpensify I agree with your point, especially since the follow-up PR was quite simple as well. Makes sense to keep it covered under the initial bounty in this case.

    Thanks everyone!

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions