mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 20:45:00 +02:00
ezqms-1029: fix permissions check for creating project doc from context menu (#6282)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
+15
-12
@@ -39,7 +39,8 @@
|
||||
setCurrentProject,
|
||||
getProjectDocsHierarchy,
|
||||
isEditableProject,
|
||||
createDocument
|
||||
createDocument,
|
||||
canCreateChildDocument
|
||||
} from '../../utils'
|
||||
|
||||
import documents from '../../plugin'
|
||||
@@ -129,17 +130,19 @@
|
||||
async function getSpaceActions (space: DocumentSpace): Promise<Action[]> {
|
||||
const actions = await getActions(space)
|
||||
|
||||
const action: Action = {
|
||||
icon: documents.icon.NewDocument,
|
||||
label: documents.string.CreateDocument,
|
||||
group: 'create',
|
||||
action: async () => {
|
||||
await createDocument(space)
|
||||
}
|
||||
}
|
||||
|
||||
if (spaceType?.projects === true && (await isEditableProject(project))) {
|
||||
actions.push(action)
|
||||
if (
|
||||
spaceType?.projects === true &&
|
||||
(await isEditableProject(project)) &&
|
||||
(await canCreateChildDocument(space, true))
|
||||
) {
|
||||
actions.push({
|
||||
icon: documents.icon.NewDocument,
|
||||
label: documents.string.CreateDocument,
|
||||
group: 'create',
|
||||
action: async () => {
|
||||
await createDocument(space)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return orderActions(actions)
|
||||
|
||||
Reference in New Issue
Block a user