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: select all workspace invite comparison #20826

Merged
Merged
12 changes: 6 additions & 6 deletions src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class WorkspaceMembersPage extends React.Component {
this.setState((prevState) => ({
selectedEmployees: _.intersection(
prevState.selectedEmployees,
_.keys(PolicyUtils.getClientPolicyMemberEmailsToAccountIDs(this.props.policyMembers, this.props.personalDetails)),
_.map(_.keys(PolicyUtils.getClientPolicyMemberEmailsToAccountIDs(this.props.policyMembers, this.props.personalDetails)), (accountID) => accountID.toString()),
),
}));
}
Expand Down Expand Up @@ -217,7 +217,7 @@ class WorkspaceMembersPage extends React.Component {
const emailList = _.keys(memberList);
this.setState(
(prevState) => ({
selectedEmployees: !_.every(emailList, (memberEmail) => _.contains(prevState.selectedEmployees, memberEmail)) ? emailList : [],
selectedEmployees: !_.every(emailList, (memberAccountID) => _.contains(prevState.selectedEmployees, memberAccountID.toString())) ? emailList : [],
}),
() => this.validate(),
);
Expand All @@ -236,10 +236,10 @@ class WorkspaceMembersPage extends React.Component {
}

// Add or remove the user if the checkbox is enabled
if (_.contains(this.state.selectedEmployees, accountID)) {
this.removeUser(accountID);
if (_.contains(this.state.selectedEmployees, accountID.toString())) {
this.removeUser(accountID.toString());
} else {
this.addUser(accountID);
this.addUser(accountID.toString());
}
}

Expand Down Expand Up @@ -320,7 +320,7 @@ class WorkspaceMembersPage extends React.Component {
*/
renderItem({item}) {
const hasError = !_.isEmpty(item.errors) || this.state.errors[item.login];
const isChecked = _.contains(this.state.selectedEmployees, item.accountID);
const isChecked = _.contains(this.state.selectedEmployees, item.accountID.toString());
return (
<OfflineWithFeedback
onClose={() => this.dismissError(item)}
Expand Down