From 18596563bf36fb27aa2a9e1496e0a67a4d00b07e Mon Sep 17 00:00:00 2001 From: wesleybl Date: Mon, 4 Mar 2024 09:45:28 -0300 Subject: [PATCH] Fix name of the canAssignGroup function --- .../Controlpanels/Users/UserGroupMembershipListing.jsx | 6 +++--- .../manage/Controlpanels/Users/UsersControlpanel.jsx | 8 ++++---- packages/volto/src/helpers/User/User.js | 4 ++-- packages/volto/src/helpers/index.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx b/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx index d12dbf10de..7c3559f6b9 100644 --- a/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx +++ b/packages/volto/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx @@ -5,7 +5,7 @@ import { useSelector, useDispatch, shallowEqual } from 'react-redux'; import jwtDecode from 'jwt-decode'; import { toast } from 'react-toastify'; import { Button, Checkbox } from 'semantic-ui-react'; -import { messages, isManager, canAssingGroup } from '@plone/volto/helpers'; +import { messages, isManager, canAssignGroup } from '@plone/volto/helpers'; import { listGroups, getUser } from '@plone/volto/actions'; import { Icon, Toast } from '@plone/volto/components'; import { updateGroup, listUsers } from '@plone/volto/actions'; @@ -236,7 +236,7 @@ const ListingTemplate = ({ checked, ) } - disabled={!canAssingGroup(isUserManager, matrix_option)} + disabled={!canAssignGroup(isUserManager, matrix_option)} /> ))} @@ -279,7 +279,7 @@ const ListingTemplate = ({ true, ); }} - disabled={!canAssingGroup(isUserManager, matrix_option)} + disabled={!canAssignGroup(isUserManager, matrix_option)} /> ))} diff --git a/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx b/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx index c7ae00337f..3b5640d8a7 100644 --- a/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +++ b/packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx @@ -29,7 +29,7 @@ import { Helmet, messages, isManager, - canAssingGroup, + canAssignGroup, } from '@plone/volto/helpers'; import clearSVG from '@plone/volto/icons/clear.svg'; import addUserSvg from '@plone/volto/icons/add-user.svg'; @@ -359,8 +359,8 @@ class UsersControlpanel extends Component { entry.id === name && !entry.roles.includes(value) ? [...entry.roles, value] : entry.id !== name - ? entry.roles - : pull(entry.roles, value), + ? entry.roles + : pull(entry.roles, value), })), }); } @@ -501,7 +501,7 @@ class UsersControlpanel extends Component { title: this.props.intl.formatMessage(messages.addUserGroupNameTitle), type: 'array', choices: this.props.groups - .filter((group) => canAssingGroup(isUserManager, group)) + .filter((group) => canAssignGroup(isUserManager, group)) .map((group) => [group.id, group.id]), noValueOption: false, }; diff --git a/packages/volto/src/helpers/User/User.js b/packages/volto/src/helpers/User/User.js index 644581bb72..636c0d2566 100644 --- a/packages/volto/src/helpers/User/User.js +++ b/packages/volto/src/helpers/User/User.js @@ -24,10 +24,10 @@ export function isManager(user) { /** * Checks if the user can assing group. - * @method canAssingGroup + * @method canAssignGroup * @returns {boolean} */ -export function canAssingGroup(isManager, group) { +export function canAssignGroup(isManager, group) { if (isManager) return true; return !group.roles.includes('Manager'); } diff --git a/packages/volto/src/helpers/index.js b/packages/volto/src/helpers/index.js index e97a5490b1..efa3d4b9fd 100644 --- a/packages/volto/src/helpers/index.js +++ b/packages/volto/src/helpers/index.js @@ -119,7 +119,7 @@ export { asyncConnect } from './AsyncConnect'; export { userHasRoles, isManager, - canAssingGroup, + canAssignGroup, canAssignRole, } from './User/User'; // export { injectLazyLibs } from './Loadable/Loadable';