Skip to content

[HOLD for payment 2024-06-20] Group chat - Member amount is 0 when creating group chat offline #43042

Closed

Description

@lanitochka17

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: 1.4-79-2
Reproducible in staging?: Y
Reproducible in production?: N
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:

  1. Go to staging.new.expensify.com
  2. Go offline
  3. Go to FAB > Start chat
  4. Create a group chat with a few users
  5. Tap on the chat header

Expected Result:

Members will show the correct number of group members

Actual Result:

Members show 0 when there are some group members

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6501741_1717515811787.zero_mem.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @ShridharGoel

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    DeployBlockerIndicates it should block deploying the API
    on Jun 4, 2024
  2. melvin-bot commented on Jun 4, 2024

    @melvin-bot

    Triggered auto assignment to @aldo-expensify (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. github-actions commented on Jun 4, 2024

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  4. lanitochka17 commented on Jun 4, 2024

    @lanitochka17
    Author

    @aldo-expensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  5. ShridharGoel commented on Jun 4, 2024

    @ShridharGoel
    Contributor

    Proposal

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

    Group chat - Member amount is 0 when creating group chat offline

    What is the root cause of that problem?

    There is an extra && isSystemChat in the below condition which causes the condition to be always false when it's a group chat.

    const participants = useMemo(() => {
    if (isGroupChat || isSystemChat) {
    // Filter out the current user from the particpants of the systemChat
    return ReportUtils.getParticipantAccountIDs(report.reportID ?? '').filter((accountID) => accountID !== session?.accountID && isSystemChat);
    }
    return ReportUtils.getVisibleChatMemberAccountIDs(report.reportID ?? '');
    }, [report, session, isGroupChat, isSystemChat]);

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

    Change it to this:

    const participants = useMemo(() => {
        if (isSystemChat) {
            // Filter out the current user from the participants of the systemChat
            return ReportUtils.getParticipantAccountIDs(report.reportID ?? '').filter((accountID) => accountID !== session?.accountID);
        }
    
        return ReportUtils.getVisibleChatMemberAccountIDs(report.reportID ?? '');
    }, [report, session, isSystemChat]);
    

    We don't need the check for isGroupChat, getVisibleChatMemberAccountIDs should be used.

  6. ShridharGoel commented on Jun 4, 2024

    @ShridharGoel
    Contributor

    @aldo-expensify Since this is a blocker, I can open a PR quickly. Can you have a look at the above proposal?

    It is caused by #41290.

  7. Nodebrute commented on Jun 4, 2024

    @Nodebrute
    Contributor

    Proposal

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

    Member amount is 0 when creating group chat offline

    What is the root cause of that problem?

    Regression caused by this PR #41290. If it's not a systemChat we are filtering out all the members. The purpose of this change was to filter current user from members list if it's a system chat

    return ReportUtils.getParticipantAccountIDs(report.reportID ?? '').filter((accountID) => accountID !== session?.accountID && isSystemChat);

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

    This was added to filter out current user from members list. But with this is also removing current user from group's members list too

    return ReportUtils.getParticipantAccountIDs(report.reportID ?? '').filter((accountID) => accountID !== session?.accountID && isSystemChat);

    So removing just isSystemChat will not work here. We can do something like this as we don't want to filter current user from member's list

       if (isGroupChat) {
               
                return ReportUtils.getParticipantAccountIDs(report.reportID ?? '');
            }
            if(isSystemChat){
                 // Filter out the current user from the particpants of the systemChat
                return ReportUtils.getParticipantAccountIDs(report.reportID ?? '').filter((accountID) => accountID !== session?.accountID)
            }
    

    What alternative solutions did you explore? (Optional)

    We don't show members page if it's a system report

    !isSystemChat

    We can remover filtering logic here

     const participants = useMemo(() => {
            if (isGroupChat) {
               
                return ReportUtils.getParticipantAccountIDs(report.reportID ?? '');
            }
    
            return ReportUtils.getVisibleChatMemberAccountIDs(report.reportID ?? '');
        }, [report, session, isGroupChat, isSystemChat]);
    
  8. ShridharGoel commented on Jun 4, 2024

    @ShridharGoel
    Contributor

    Proposal

    Updated to add full function code.

  9. Nodebrute commented on Jun 4, 2024

    @Nodebrute
    Contributor

    Proposal Updated

    Alternative solution added

  10. ShridharGoel commented on Jun 4, 2024

    @ShridharGoel
    Contributor

    Proposal

    Updated to add few more details.

  11. aldo-expensify commented on Jun 4, 2024

    @aldo-expensify
    Contributor
  12. 53 remaining items

  13. sonialiap commented on Jun 20, 2024

    @sonialiap
    Contributor

    Payment summary:

  14. melvin-bot commented on Jun 20, 2024

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@sonialiap)

    • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  15. sonialiap commented on Jun 24, 2024

    @sonialiap
    Contributor

    @ShridharGoel please accept the offer and complete the checklist steps in which you are tagged

  16. sonialiap commented on Jul 3, 2024

    @sonialiap
    Contributor

    @ShridharGoel please accept the offer. I've also sent you a message in Upwork in case you see that first

  17. ShridharGoel commented on Jul 3, 2024

    @ShridharGoel
    Contributor

    Accepted, thanks.

  18. sonialiap commented on Jul 3, 2024

    @sonialiap
    Contributor

    @ShridharGoel please complete the checklist

  19. ShridharGoel commented on Jul 3, 2024

    @ShridharGoel
    Contributor

    @sonialiap I think that would be handled by @aldo-expensify.

  20. sonialiap commented on Jul 4, 2024

    @sonialiap
    Contributor

    @ShridharGoel melvin assigned you to the regression part of the checklist

  21. melvin-bot commented on Jul 29, 2024

    @melvin-bot

    This issue has not been updated in over 15 days. @sonialiap, @ShridharGoel, @aldo-expensify 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!

  22. ShridharGoel commented on Jul 30, 2024

    @ShridharGoel
    Contributor

    Determine if we should create a regression test for this bug.

    Looks like no additional test is needed, if we already have a test to check the member count when offline.

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions