Skip to content

[HOLD for payment 2025-05-05][$250] Workspace - System message about member that left, disappears from chat preview on search #58240

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

Closed
7 of 8 tasks
jponikarchuk opened this issue Mar 11, 2025 · 25 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

@jponikarchuk
Copy link

jponikarchuk commented Mar 11, 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.11-3
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: https://expensify.testrail.io/index.php?/tests/view/5724469&group_by=cases:section_id&group_order=asc&group_id=296762
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: Search

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Open any workspace chat.
  3. Mention another user that is not part of the workspace chat.
  4. Tap on "Invite them"
  5. Switch to User B account.
  6. Open workspace chat and tap on header.
  7. Leave the chat.
  8. Return to User A account.
  9. Tap on the search icon.
  10. Check that chat preview displays the system message showing that User B left.
  11. Return to LHN and open the workspace chat.
  12. Return to LHN again.
  13. Tap on the search icon again.
  14. Check the message displayed on chat preview after this last action.

Expected Result:

System message showing the information about an user that left the chat, should remain on chat preview on search, after reopening chat and returning to LHN.

Actual Result:

System message showing that another user left workspace chat, disappears from chat preview on search, after reopening chat and returning to LHN. Previous message is displayed again on preview after this action.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

View all open jobs on GitHub

Bug6767561_1741706814238.Left.mp4
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021900719600654813275
  • Upwork Job ID: 1900719600654813275
  • Last Price Increase: 2025-03-15
  • Automatic offers:
    • daledah | Contributor | 106583191
Issue OwnerCurrent Issue Owner: @cristipaval
@jponikarchuk jponikarchuk added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 11, 2025
Copy link

melvin-bot bot commented Mar 11, 2025

Triggered auto assignment to @stephanieelliott (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.

@melvin-bot melvin-bot bot added the Overdue label Mar 14, 2025
@stephanieelliott
Copy link
Contributor

The number of action steps you need to take make this seem somewhat edge case, but this does seem like weird behavior that users could run into in a few different scenarios, so it's worth fixing IMO

@melvin-bot melvin-bot bot removed the Overdue label Mar 15, 2025
@stephanieelliott stephanieelliott added External Added to denote the issue can be worked on by a contributor Overdue labels Mar 15, 2025
@melvin-bot melvin-bot bot changed the title Workspace - System message about member that left, disappears from chat preview on search [$250] Workspace - System message about member that left, disappears from chat preview on search Mar 15, 2025
Copy link

melvin-bot bot commented Mar 15, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 15, 2025
Copy link

melvin-bot bot commented Mar 15, 2025

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

@daledah
Copy link
Contributor

daledah commented Mar 16, 2025

Proposal

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

System message showing that another user left workspace chat, disappears from chat preview on search, after reopening chat and returning to LHN. Previous message is displayed again on preview after this action.

What is the root cause of that problem?

The report option displayed in the search route is generated through this function:

function createOption(

and the last message preview in the report option comes from:
const lastMessageTextFromReport = getLastMessageTextForReport(report, lastActorDetails);

The issue arises from the function getLastMessageTextForReport, which lacks logic to handle cases where the last action is LEAVEROOM. This causes it to fall back to report.lastMessageText:

return lastMessageTextFromReport || (report?.lastMessageText ?? '');
, which is an unreliable source for the last message preview due to:

  1. Language limitation: report.lastMessageText is not translated, so it's always displayed in English.
  2. Incorrect data: report.lastMessageText may hold outdated or incorrect content. In this specific bug, it contains the previous message instead of showing "left the chat" as expected.

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

We need to properly handle the LEAVEROOM action, similar to how other message types are managed. Specifically, we should add an extra else if block in this section:

    } else if (lastReportAction?.actionName === 'LEAVEROOM') {
        lastMessageTextFromReport = 'leave the chat'; // The text should be translated here.
    }

This update ensures the correct last message is displayed. However, there’s an additional issue with the lastActorDisplayName used in the message preview:

lastMessageText = `${lastActorDisplayName}: ${lastMessageTextFromReport}`;

Currently, report.lastActorAccountID holds an incorrect value. To fix this completely, the backend must ensure it returns the correct lastActorAccountID reflecting the user who left the chat. This will allow the UI to display the right actor’s name in the preview.

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

Add a test case for getLastMessageTextForReport that covers the LEAVEROOM action. Ensure the function correctly returns the expected value — like "leave the chat" — and handles translations properly.

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Mar 18, 2025

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

@stephanieelliott
Copy link
Contributor

Hey @getusha we have some proposals here, can you please review

@dukenv0307
Copy link
Contributor

@stephanieelliott I think @getusha is not available this time. I'm on low bandwidth I can help take this issue as C+

@getusha
Copy link
Contributor

getusha commented Mar 19, 2025

Will address this today

@melvin-bot melvin-bot bot removed the Overdue label Mar 19, 2025
@getusha
Copy link
Contributor

getusha commented Mar 19, 2025

Incorrect data: report.lastMessageText may hold outdated or incorrect content. In this specific bug, it contains the previous message instead of showing "left the chat" as expected.

@daledah are you suggesting this could be fixed from the backend?

@getusha
Copy link
Contributor

getusha commented Mar 19, 2025

We should add the condition to handle the translation issue as well. @daledah's proposal looks good to me.
🎀 👀 🎀 C+ Reviewed

Copy link

melvin-bot bot commented Mar 19, 2025

Triggered auto assignment to @cristipaval, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 19, 2025
Copy link

melvin-bot bot commented Mar 19, 2025

📣 @daledah 🎉 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 Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 20, 2025
@daledah
Copy link
Contributor

daledah commented Mar 20, 2025

@getusha PR is ready.

@stephanieelliott
Copy link
Contributor

PR is still under review

@stephanieelliott
Copy link
Contributor

Conflicts have been resolved, PR is just awaiting final review

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Apr 14, 2025
Copy link

melvin-bot bot commented Apr 14, 2025

This issue has not been updated in over 15 days. @cristipaval, @stephanieelliott, @getusha, @daledah eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@cristipaval cristipaval added Weekly KSv2 and removed Monthly KSv2 labels Apr 14, 2025
@cristipaval
Copy link
Contributor

Ok, I assigned this to me to fix the backend.

@cristipaval
Copy link
Contributor

ˆAuth PR that fixes the backend is in review

@cristipaval
Copy link
Contributor

The BE fix is deployed.

@stephanieelliott
Copy link
Contributor

@daledah the BE change is deployed, if you haven't already can you please resume work on PR?

@daledah
Copy link
Contributor

daledah commented Apr 29, 2025

@stephanieelliott The PR is merged now, we're not blocked by BE changes.

@stephanieelliott
Copy link
Contributor

Oh great! Ok seems like the automation didn't work for this one, updating manually to queue for payment

@stephanieelliott stephanieelliott changed the title [$250] Workspace - System message about member that left, disappears from chat preview on search [HOLD for payment 2025-05-05][$250] Workspace - System message about member that left, disappears from chat preview on search May 3, 2025
@stephanieelliott stephanieelliott added the Awaiting Payment Auto-added when associated PR is deployed to production label May 3, 2025
@stephanieelliott
Copy link
Contributor

Summarizing payment on this issue:

  • Contributor: @daledah $250 $250 via Upwork - PAID!
  • Contributor+: @getusha$250 via ND - please request!

Upwork job is here: https://www.upwork.com/jobs/~021900719600654813275

@garrettmknight
Copy link
Contributor

$250 approved for @getusha

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: DONE
Development

No branches or pull requests

7 participants