Skip to content
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

[$250] LHN - WS chat not moved to the bottom when going back online after removing member offline #56961

Open
5 of 8 tasks
IuliiaHerets opened this issue Feb 17, 2025 · 7 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 Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 17, 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.0.99-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: https://expensify.testrail.io/index.php?/tests/view/5602936&group_by=cases:section_id&group_order=asc&group_id=229067
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 Expensify app.
  2. Tap on "Settings" and select "Workspace"
  3. Open any workspace and select "Members"
  4. Invite any user to the workspace.
  5. Return to LHN and check if a new workspace chat was created for the invited user,
  6. Turn off internet connection.
  7. Tap on "Settings" and select "Workspaces"
  8. Open the same workspace and select "Members"
  9. Remove the invited member.
  10. Return to LHN and open the member´s workspace chat.
  11. Send some messages.
  12. Return to LHN and turn on internet connection.
  13. Remove the error messages displayed on the messages sent.
  14. Return to LHN again and check if the workspace chat is now displayed on the bottom or stayed on the same place.

Expected Result:

Member´s workspace chat should be moved to the bottom of LHN, when recovering internet connection after removing the member while offline.

Actual Result:

Workspace chat is not moved to the bottom on inbox, after removing a member while offline, sending some messages to it and turning internet connection on again.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6745927_1739811394730.Member.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021892211108733310047
  • Upwork Job ID: 1892211108733310047
  • Last Price Increase: 2025-02-19
Issue OwnerCurrent Issue Owner: @hoangzinh
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 17, 2025
Copy link

melvin-bot bot commented Feb 17, 2025

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

@bernhardoj
Copy link
Contributor

Proposal

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

I see we have 2 issues here. First, archived WS chat doesn't move to the bottom. Second, the WS isn't archived optimistically.

What is the root cause of that problem?

When we add a comment to the archived workspace, an error will be thrown from the BE. If the report has an error, then it will be prioritized over the archived report case.

} else if (report?.hasErrorsOtherThanFailedReceipt) {
errorReports.push(miniReport);
} else if (hasValidDraftComment(report?.reportID)) {
draftReports.push(miniReport);
} else if (isArchivedNonExpenseReport(report, reportNameValuePairs)) {
archivedReports.push(miniReport);
} else {

This is why the WS chat doesn't move to bottom. Now for the second issue, we don't optimistically archive the WS report.

workspaceChats.forEach((report) => {
optimisticData.push(
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${report?.reportID}`,
value: {
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
oldPolicyName: policy?.name,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${report?.reportID}`,
value: {
pendingChatMembers,
},
},
);

We actually did that by setting the statusNum and stateNum, but the new way to archive the report is by setting the reportNameValuePairs private_isArchived property.

App/src/libs/ReportUtils.ts

Lines 1760 to 1762 in ae3830d

function isArchivedNonExpenseReport(report: OnyxInputOrEntry<Report> | SearchReport, reportNameValuePairs?: OnyxInputOrEntry<ReportNameValuePairs>): boolean {
return !(isExpenseReport(report) || isExpenseRequest(report)) && !!reportNameValuePairs?.private_isArchived;
}

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

If we want the archived report even with error to move to the bottom, then we need to reorder the prioritazion here, but I think the real problem here is that we don't optimistically archive and we need to optimistically archive it.

{
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`,
    value: {
        private_isArchived: true,
    },
},

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

We need to test removeMembers to make sure the workspace chat is optimistically archived by checking the REPORT_NAME_VALUE_PAIRS private_isArchived.

@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label Feb 19, 2025
Copy link

melvin-bot bot commented Feb 19, 2025

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

@melvin-bot melvin-bot bot changed the title LHN - WS chat not moved to the bottom when going back online after removing member offline [$250] LHN - WS chat not moved to the bottom when going back online after removing member offline Feb 19, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 19, 2025
Copy link

melvin-bot bot commented Feb 19, 2025

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

@sonialiap sonialiap moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Feb 19, 2025
@hoangzinh
Copy link
Contributor

@bernhardoj's RCA and solution look good to me. Yep, we should optimistically archive workspace chat when offline.

Link to proposal #56961 (comment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Feb 21, 2025

Triggered auto assignment to @Beamanator, 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 Feb 21, 2025
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 22, 2025
@bernhardoj
Copy link
Contributor

PR is ready

cc: @hoangzinh

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 Reviewing Has a PR in review Weekly KSv2
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

5 participants