Skip to content

Commit 74a6195

Browse files
authored
Merge pull request #39796 from GandalfGwaihir/issue39446
[Fix]: Number of announce room members does not update when remove workspace members due to `pendingAction`
2 parents 4cf2976 + f742baa commit 74a6195

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/pages/ReportDetailsPage.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
9090
return ReportUtils.getVisibleChatMemberAccountIDs(report.reportID ?? '');
9191
}, [report, isGroupChat]);
9292

93+
// Get the active chat members by filtering out the pending members with delete action
94+
const activeChatMembers = participants.flatMap((accountID) => {
95+
const pendingMember = report?.pendingChatMembers?.findLast((member) => member.accountID === accountID.toString());
96+
return !pendingMember || pendingMember.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? accountID : [];
97+
});
98+
9399
const isGroupDMChat = useMemo(() => ReportUtils.isDM(report) && participants.length > 1, [report, participants.length]);
94100
const isPrivateNotesFetchTriggered = report?.isLoadingPrivateNotes !== undefined;
95101

@@ -140,7 +146,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
140146
key: CONST.REPORT_DETAILS_MENU_ITEM.MEMBERS,
141147
translationKey: 'common.members',
142148
icon: Expensicons.Users,
143-
subtitle: participants.length,
149+
subtitle: activeChatMembers.length,
144150
isAnonymousAction: false,
145151
action: () => {
146152
if (isUserCreatedPolicyRoom || isChatThread) {
@@ -200,6 +206,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
200206
session,
201207
isSelfDM,
202208
isDefaultRoom,
209+
activeChatMembers.length,
203210
isGroupChat,
204211
]);
205212

0 commit comments

Comments
 (0)