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

[Fix]: Number of announce room members does not update when remove workspace members due to pendingAction #39796

Merged
merged 14 commits into from
Apr 15, 2024
9 changes: 8 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
return ReportUtils.getVisibleChatMemberAccountIDs(report.reportID ?? '');
}, [report, isGroupChat]);

// Get the active chat members by filtering out the pending members with delete action
const activeChatMembers = participants.flatMap((accountID) => {
const pendingMember = report?.pendingChatMembers?.findLast((member) => member.accountID === accountID.toString());
return !pendingMember || pendingMember.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? accountID : [];
});
Comment on lines +95 to +97
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not filter out the accountID that is not available in the personalDetails object. This resulted in #46670


const isGroupDMChat = useMemo(() => ReportUtils.isDM(report) && participants.length > 1, [report, participants.length]);
const isPrivateNotesFetchTriggered = report?.isLoadingPrivateNotes !== undefined;

Expand Down Expand Up @@ -140,7 +146,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
key: CONST.REPORT_DETAILS_MENU_ITEM.MEMBERS,
translationKey: 'common.members',
icon: Expensicons.Users,
subtitle: participants.length,
subtitle: activeChatMembers.length,
isAnonymousAction: false,
action: () => {
if (isUserCreatedPolicyRoom || isChatThread) {
Expand Down Expand Up @@ -200,6 +206,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
session,
isSelfDM,
isDefaultRoom,
activeChatMembers.length,
isGroupChat,
]);

Expand Down
Loading