fix: '+' button appearing on collections in sidewith without document creation policy
This commit is contained in:
@@ -90,8 +90,18 @@ export const createDocument = createAction({
|
|||||||
section: DocumentSection,
|
section: DocumentSection,
|
||||||
icon: <NewDocumentIcon />,
|
icon: <NewDocumentIcon />,
|
||||||
keywords: "create",
|
keywords: "create",
|
||||||
visible: ({ currentTeamId, stores }) =>
|
visible: ({ currentTeamId, activeCollectionId, stores }) => {
|
||||||
!!currentTeamId && stores.policies.abilities(currentTeamId).createDocument,
|
if (
|
||||||
|
activeCollectionId &&
|
||||||
|
!stores.policies.abilities(activeCollectionId).createDocument
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
!!currentTeamId && stores.policies.abilities(currentTeamId).createDocument
|
||||||
|
);
|
||||||
|
},
|
||||||
perform: ({ activeCollectionId, inStarredSection }) =>
|
perform: ({ activeCollectionId, inStarredSection }) =>
|
||||||
history.push(newDocumentPath(activeCollectionId), {
|
history.push(newDocumentPath(activeCollectionId), {
|
||||||
starred: inStarredSection,
|
starred: inStarredSection,
|
||||||
|
|||||||
Reference in New Issue
Block a user