Skip to content

Commit

Permalink
Merge pull request #50158 from dominictb/fix/48931
Browse files Browse the repository at this point in the history
fix: admin cannot open room member details
  • Loading branch information
tgolen authored Oct 14, 2024
2 parents 9728f15 + 7d8b6ba commit 8ab4792
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pages/RoomMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function RoomMembersPage({report, policies}: RoomMembersPageProps) {

/** Add or remove all users passed from the selectedMembers list */
const toggleAllUsers = (memberList: ListItem[]) => {
const enabledAccounts = memberList.filter((member) => !member.isDisabled);
const enabledAccounts = memberList.filter((member) => !member.isDisabled && !member.isDisabledCheckbox);
const everyoneSelected = enabledAccounts.every((member) => {
if (!member.accountID) {
return false;
Expand Down Expand Up @@ -217,18 +217,19 @@ function RoomMembersPage({report, policies}: RoomMembersPageProps) {
}
const pendingChatMember = report?.pendingChatMembers?.findLast((member) => member.accountID === accountID.toString());
const isAdmin = !!(policy && policy.employeeList && details.login && policy.employeeList[details.login]?.role === CONST.POLICY.ROLE.ADMIN);
const isDisabled =
const isDisabled = pendingChatMember?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || details.isOptimisticPersonalDetail;
const isDisabledCheckbox =
(isPolicyExpenseChat && isAdmin) ||
accountID === session?.accountID ||
pendingChatMember?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ||
details.accountID === report.ownerAccountID ||
details.isOptimisticPersonalDetail;
details.accountID === report.ownerAccountID;

result.push({
keyForList: String(accountID),
accountID,
isSelected: selectedMembers.includes(accountID),
isDisabled,
isDisabledCheckbox,
text: formatPhoneNumber(PersonalDetailsUtils.getDisplayNameOrDefault(details)),
alternateText: details?.login ? formatPhoneNumber(details.login) : '',
icons: [
Expand Down

0 comments on commit 8ab4792

Please sign in to comment.