Skip to content

[$250] LHN - Deleted in 1:1 chat expense remains in LHN with the receive's name changed to the email #57694

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
1 of 8 tasks
lanitochka17 opened this issue Mar 3, 2025 · 21 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 3, 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.8-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

User A logged in on the main testing device, User B - on secondary device

  1. Navigate to staging.new.expensify.com and log in as a gmail user
  2. As User A, create a chat with User B, sen some messages
  3. As User A, navigate to another chat
  4. As User B, create manual expense in the chat with user A
  5. User A, observe the LHN for the chat. Make sure, the chat is bold and the expense action is shown (User A owes $..). Do not open the chat.
  6. User B, delete the expense
  7. User A, observe the LHN again

Expected Result:

Deleted in 1:1 chat expense should be removed from LHN, the last remaining message in the chat should be shown

Actual Result:

Deleted in 1:1 chat expense remains in LHN with the receiver's name changed to the email

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6760189_1741028585300.Deleted_expense_LHN.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021897023196486831591
  • Upwork Job ID: 1897023196486831591
  • Last Price Increase: 2025-03-04
  • Automatic offers:
    • brunovjk | Reviewer | 106462677
    • jaydamani | Contributor | 106462679
Issue OwnerCurrent Issue Owner: @brunovjk
@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 3, 2025
Copy link

melvin-bot bot commented Mar 3, 2025

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

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

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

@melvin-bot melvin-bot bot changed the title LHN - Deleted in 1:1 chat expense remains in LHN with the receive's name changed to the email [$250] LHN - Deleted in 1:1 chat expense remains in LHN with the receive's name changed to the email Mar 4, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 4, 2025
Copy link

melvin-bot bot commented Mar 4, 2025

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

@brunovjk

This comment has been minimized.

@brunovjk
Copy link
Contributor

brunovjk commented Mar 6, 2025

I can reproduce, waiting for proposals.

Screen.Recording.2025-03-06.at.16.14.24.mov

@jaydamani
Copy link
Contributor

Proposal

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

Deleted in 1:1 chat expense remains in LHN with the receive's name changed to the email

What is the root cause of that problem?

When the user B deletes a message, for user A the reportAction is deleted but the lastMessageText and lastVisibleActionCreated of the report is not updated. Due to this, when the expense is deleted and the updated last visible action is a ADD_COMMENT, the LHN shows lastMessageText and the report is shown as unread which is incorrect as it shows stale data

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

For LHN text:

The LHN text based on the last report is handled by getLastMessageTextForReport which will fallback to report.lastMessageText for report actions like ADD_COMMENT as they don't have any special handling

When lastOriginalReportAction is a deleted action, we should fallback to getReportLastMessage(reportID).lastMessageText which will find the lastMessageText based on the last visible action

we already do this for closed report action so we just need to add a or condition for our case.

if (reportID && !isArchivedReport(reportNameValuePairs) && report.lastActionType === CONST.REPORT.ACTIONS.TYPE.CLOSED) {
return lastMessageTextFromReport || (getReportLastMessage(reportID).lastMessageText ?? '');
}

so the updated code will be

    if (reportID && !isArchivedReport(reportNameValuePairs) && (isDeletedAction(lastOriginalReportAction) || report.lastActionType === CONST.REPORT.ACTIONS.TYPE.CLOSED)) {
        return lastMessageTextFromReport || (getReportLastMessage(reportID).lastMessageText ?? '');
    }

For read/unread highlight

The unread highlight is handled by isUnread() which gets lastVisibleActionCreated from getReportLastVisibleActionCreated. We can update getReportLastVisibleActionCreated to use report actions whenever possible

function getReportLastVisibleActionCreated(report: OnyxEntry<Report>, oneTransactionThreadReport: OnyxEntry<Report>) {
    const lastVisibleReportActionCreated = getLastVisibleActionReportActionsUtils(report?.reportID)?.created ?? report?.lastVisibleActionCreated ?? ''
    const lastVisibleActionCreated =
        (oneTransactionThreadReport?.lastVisibleActionCreated ?? '') > lastVisibleReportActionCreated
            ? oneTransactionThreadReport?.lastVisibleActionCreated
            : lastVisibleReportActionCreated;

    return lastVisibleActionCreated;
}

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

Test getReportLastVisibleActionCreated and getLastMessageTextForReport return correct values when there is a deleted report action

What alternative solutions did you explore? (Optional)

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.

@brunovjk
Copy link
Contributor

brunovjk commented Mar 8, 2025

@jaydamani's proposal makes sense to me, I tested it and it works well.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 8, 2025

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

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Mar 10, 2025
Copy link

melvin-bot bot commented Mar 10, 2025

📣 @brunovjk 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Mar 10, 2025

📣 @jaydamani 🎉 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 📖

@jaydamani
Copy link
Contributor

Working on this, PR should be up soon

@jaydamani
Copy link
Contributor

created draft PR

@brunovjk
Copy link
Contributor

Not overdue, Contributor is working on PR.

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2025
@brunovjk
Copy link
Contributor

Update: We are still working on the PR.

@lschurr lschurr moved this to Bugs and Follow Up Issues in #expensify-bugs Mar 17, 2025
Copy link

melvin-bot bot commented Mar 19, 2025

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

@melvin-bot melvin-bot bot added the Overdue label Mar 19, 2025
@jaydamani
Copy link
Contributor

PR is in progress, waiting on some back end changes

@brunovjk
Copy link
Contributor

PR is in progress, waiting on some back end changes

Not overdue 🚀

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Overdue Daily KSv2 labels Mar 19, 2025
@brunovjk
Copy link
Contributor

Update: We are still working on the PR

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Apr 21, 2025
Copy link

melvin-bot bot commented Apr 21, 2025

This issue has not been updated in over 15 days. @thienlnam, @lschurr, @jaydamani, @brunovjk 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!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Apr 21, 2025
@brunovjk
Copy link
Contributor

brunovjk commented Apr 21, 2025

Update: We are still working on the PR

Update: Same as above

1 similar comment
@brunovjk
Copy link
Contributor

Update: We are still working on the PR

Update: Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

5 participants