Skip to content

Commit

Permalink
Fix name of the canAssignGroup function
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleybl committed Mar 4, 2024
1 parent b53e97b commit 1859656
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -236,7 +236,7 @@ const ListingTemplate = ({
checked,
)
}
disabled={!canAssingGroup(isUserManager, matrix_option)}
disabled={!canAssignGroup(isUserManager, matrix_option)}
/>
</div>
))}
Expand Down Expand Up @@ -279,7 +279,7 @@ const ListingTemplate = ({
true,
);
}}
disabled={!canAssingGroup(isUserManager, matrix_option)}
disabled={!canAssignGroup(isUserManager, matrix_option)}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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

Check failure on line 362 in packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
: pull(entry.roles, value),

Check failure on line 363 in packages/volto/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
})),
});
}
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/volto/src/helpers/User/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/volto/src/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export { asyncConnect } from './AsyncConnect';
export {
userHasRoles,
isManager,
canAssingGroup,
canAssignGroup,
canAssignRole,
} from './User/User';
// export { injectLazyLibs } from './Loadable/Loadable';
Expand Down

0 comments on commit 1859656

Please sign in to comment.