From 3002b0c8610c0906b0b76a9bb88e3f0c9c554937 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 29 Mar 2024 18:21:46 +0800 Subject: [PATCH 1/2] get the latest pending action of member --- src/pages/ReportParticipantsPage.tsx | 2 +- src/pages/RoomMembersPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index a2b2f094ac26..fa5f2b0947c5 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -50,7 +50,7 @@ const getAllParticipants = ( !!userPersonalDetail?.login && !CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID) ? LocalePhoneNumber.formatPhoneNumber(userPersonalDetail.login) : translate('common.hidden'); const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(userPersonalDetail); - const pendingChatMember = report?.pendingChatMembers?.find((member) => member.accountID === accountID.toString()); + const pendingChatMember = report?.pendingChatMembers?.findLast((member) => member.accountID === accountID.toString()); return { alternateText: userLogin, pendingAction: pendingChatMember?.pendingAction, diff --git a/src/pages/RoomMembersPage.tsx b/src/pages/RoomMembersPage.tsx index 6cdcc6e06b95..220323e3ad85 100644 --- a/src/pages/RoomMembersPage.tsx +++ b/src/pages/RoomMembersPage.tsx @@ -198,7 +198,7 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { return; } } - const pendingChatMember = report?.pendingChatMembers?.find((member) => member.accountID === accountID.toString()); + const pendingChatMember = report?.pendingChatMembers?.findLast((member) => member.accountID === accountID.toString()); result.push({ keyForList: String(accountID), From 3ca25eeccbfe4cef6c3ab4837ea05b42f96c9955 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 30 Mar 2024 15:17:52 +0800 Subject: [PATCH 2/2] fix removed user isn't strikethrough-ed --- src/components/OptionRow.tsx | 22 +++++++++++----------- src/libs/actions/Policy.ts | 5 ----- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/components/OptionRow.tsx b/src/components/OptionRow.tsx index c72cdd1fd898..90ccff47b2b9 100644 --- a/src/components/OptionRow.tsx +++ b/src/components/OptionRow.tsx @@ -154,14 +154,14 @@ function OptionRow({ } return ( - - - {(hovered) => ( + + {(hovered) => ( + )} - )} - - + + )} + ); } diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 0c6bd7682add..3c34e823ac9a 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -780,15 +780,12 @@ function removeOptimisticAnnounceRoomMembers(policyID: string, accountIDs: numbe } if (announceReport?.participantAccountIDs) { - const remainUsers = announceReport.participantAccountIDs.filter((e) => !accountIDs.includes(e)); const pendingChatMembers = ReportUtils.getPendingChatMembers(accountIDs, announceReport?.pendingChatMembers ?? [], CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); announceRoomMembers.onyxOptimisticData.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${announceReport.reportID}`, value: { - participantAccountIDs: [...remainUsers], - visibleChatMemberAccountIDs: [...remainUsers], pendingChatMembers, }, }); @@ -797,8 +794,6 @@ function removeOptimisticAnnounceRoomMembers(policyID: string, accountIDs: numbe onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${announceReport.reportID}`, value: { - participantAccountIDs: announceReport.participantAccountIDs, - visibleChatMemberAccountIDs: announceReport.visibleChatMemberAccountIDs, pendingChatMembers: announceReport?.pendingChatMembers ?? null, }, });