fix: Options to create a document is available when the policies of collection in the context doesn't permits the user (#2424)

This commit is contained in:
Saumya Pandey
2021-08-06 22:58:26 +05:30
committed by GitHub
parent 5bdee1204e
commit 42b384688d
5 changed files with 78 additions and 55 deletions

View File

@@ -66,6 +66,7 @@ function DocumentListItem(props: Props, ref) {
const canStar =
!document.isDraft && !document.isArchived && !document.isTemplate;
const can = policies.abilities(currentTeam.id);
const canCollection = policies.abilities(document.collectionId);
return (
<DocumentLink
@@ -126,7 +127,8 @@ function DocumentListItem(props: Props, ref) {
{document.isTemplate &&
!document.isArchived &&
!document.isDeleted &&
can.createDocument && (
can.createDocument &&
canCollection.update && (
<>
<Button
as={Link}