-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[ON HOLD for #43065] Workspace - Workspace member can remove the owner #43592
Comments
Triggered auto assignment to @CortneyOfstad ( |
@CortneyOfstad 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 |
ProposalPlease re-state the problem that we are trying to solve in this issue.Workspace - Workspace member can remove the owner What is the root cause of that problem?Selecting members is always selected. App/src/pages/RoomMembersPage.tsx Line 278 in 073ce7f
What changes do you think we should make in order to solve the problem?We should get the policy and check if the current user is policy admin and only then allow selection. const reportPolicy = useMemo(() => policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? ''}`], [policies, report?.policyID]);
const isPolicyAdmin = PolicyUtils.isPolicyAdmin(reportPolicy ?? {});
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
// Pass to SelectionList
canSelectMultiple={isPolicyExpenseChat ? isPolicyAdmin : true} We should also hide the buttons at the top and searchbar if needed. We also need to update /** Toggle user from the selectedMembers list */
const toggleUser = useCallback(
({accountID, pendingAction}: ListItem) => {
if (pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || !accountID) {
return;
}
if (!isPolicyAdmin) {
Navigation.navigate(ROUTES.PROFILE.getRoute(accountID, Navigation.getActiveRoute()));
return;
}
// Add or remove the user if the checkbox is enabled
if (selectedMembers.includes(accountID)) {
removeUser(accountID);
} else {
addUser(accountID);
}
},
[selectedMembers, addUser, removeUser, isPolicyAdmin],
// If we want to make the options disabled then update `isDisabled` property in `getMemberOptions`.
isDisabled: accountID === session?.accountID || pendingChatMember?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || !isPolicyAdmin What alternative solutions did you explore? (Optional)I think we don't even need to check for const isPolicyAdmin = useMemo(() => {
if (!report?.policyID || policies === null) {
return false;
}
const reportPolicy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? ''}`];
return PolicyUtils.isPolicyAdmin(reportPolicy ?? {});
}, [report?.policyID, policies]); |
Proposal Updated
|
I think this is being handled in #43065 |
Yep, this is being tackled within that PR, so going to put this on-hold so we can keep an eye on it 👍 |
Went into production 2 days ago 🎉 Will keep this open until the hold period is open 👍 |
Hold period is complete, so closing!! |
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.82-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): gocemate+a247@gmail.com
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
User B ( member ) should not be allowed to remove the owner
Actual Result:
Workspace member can remove the owner
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6511053_1718209248995.Recording__3186.mp4
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: