Merge branch 'master' into remove-apidoc-comments

This commit is contained in:
Michael Drury 2023-10-27 13:36:07 +01:00 committed by GitHub
commit a669712d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View File

@ -39,7 +39,15 @@
allowCreator
) => {
if (allowedRoles?.length) {
return roles.filter(role => allowedRoles.includes(role._id))
const filteredRoles = roles.filter(role =>
allowedRoles.includes(role._id)
)
return [
...filteredRoles,
...(allowedRoles.includes(Constants.Roles.CREATOR)
? [{ _id: Constants.Roles.CREATOR, name: "Creator", enabled: false }]
: []),
]
}
let newRoles = [...roles]
@ -129,8 +137,9 @@
getOptionColour={getColor}
getOptionIcon={getIcon}
isOptionEnabled={option =>
option._id !== Constants.Roles.CREATOR ||
$licensing.perAppBuildersEnabled}
(option._id !== Constants.Roles.CREATOR ||
$licensing.perAppBuildersEnabled) &&
option.enabled !== false}
{placeholder}
{error}
/>

View File

@ -516,6 +516,13 @@
}
return null
}
const parseRole = user => {
if (user.isAdminOrGlobalBuilder) {
return Constants.Roles.CREATOR
}
return user.role
}
</script>
<svelte:window on:keydown={handleKeyDown} />
@ -725,7 +732,7 @@
<RoleSelect
footer={getRoleFooter(user)}
placeholder={false}
value={user.role}
value={parseRole(user)}
allowRemove={user.role && !user.group}
allowPublic={false}
allowCreator={true}
@ -744,7 +751,7 @@
autoWidth
align="right"
allowedRoles={user.isAdminOrGlobalBuilder
? [Constants.Roles.ADMIN]
? [Constants.Roles.CREATOR]
: null}
/>
</div>