summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/new/newFileRequest.ts
blob: 55b7f534610e577822fdc8223714b21071ef2af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
 * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import type { Entry, Folder, Node } from '@nextcloud/files'

import { defineAsyncComponent } from 'vue'
import { spawnDialog } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import FileUploadSvg from '@mdi/svg/svg/file-upload.svg?raw'

import Config from '../services/ConfigService'
const sharingConfig = new Config()

const NewFileRequestDialogVue = defineAsyncComponent(() => import('../components/NewFileRequestDialog.vue'))

export const EntryId = 'file-request'

export const entry = {
	id: EntryId,
	displayName: t('files_sharing', 'Create file request'),
	iconSvgInline: FileUploadSvg,
	order: 10,
	enabled(): boolean {
		// We will check for the folder permission on the dialog
		return sharingConfig.isPublicShareAllowed
	},
	async handler(context: Folder, content: Node[]) {
		spawnDialog(NewFileRequestDialogVue, {
			context,
			content,
		})
	},
} as Entry