diff options
Diffstat (limited to 'apps/files/src/newMenu/newTemplatesFolder.ts')
-rw-r--r-- | apps/files/src/newMenu/newTemplatesFolder.ts | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/apps/files/src/newMenu/newTemplatesFolder.ts b/apps/files/src/newMenu/newTemplatesFolder.ts index fafee553a10..bf6862bda08 100644 --- a/apps/files/src/newMenu/newTemplatesFolder.ts +++ b/apps/files/src/newMenu/newTemplatesFolder.ts @@ -1,25 +1,6 @@ /** - * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Julius Härtl <jus@bitgrid.net> - * @author Ferdinand Thiessen <opensource@fthiessen.de> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import type { Entry, Folder, Node } from '@nextcloud/files' @@ -34,9 +15,11 @@ import { newNodeName } from '../utils/newNodeDialog' import PlusSvg from '@mdi/svg/svg/plus.svg?raw' import axios from '@nextcloud/axios' -import logger from '../logger.js' +import logger from '../logger.ts' +const templatesEnabled = loadState<boolean>('files', 'templates_enabled', true) let templatesPath = loadState<string|false>('files', 'templates_path', false) +logger.debug('Templates folder enabled', { templatesEnabled }) logger.debug('Initial templates folder', { templatesPath }) /** @@ -72,12 +55,12 @@ const initTemplatesFolder = async function(directory: Folder, name: string) { export const entry = { id: 'template-picker', - displayName: t('files', 'Create new templates folder'), + displayName: t('files', 'Create templates folder'), iconSvgInline: PlusSvg, - order: 10, + order: 30, enabled(context: Folder): boolean { - // Templates folder already initialized - if (templatesPath) { + // Templates disabled or templates folder already initialized + if (!templatesEnabled || templatesPath) { return false } // Allow creation on your own folders only |