aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorPawel Boguslawski <pawel.boguslawski@ib.pl>2025-01-16 14:47:14 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-01-27 16:19:00 +0000
commit64e261dad7ea0ab5a1ba62f33e8cd0a228d07136 (patch)
treee5c3776cbe082c12c2974e005358d8de1f532e3f /apps/files
parent62a74d82644bf5a06fbd208f697c6000c1e6dcf0 (diff)
downloadnextcloud-server-64e261dad7ea0ab5a1ba62f33e8cd0a228d07136.tar.gz
nextcloud-server-64e261dad7ea0ab5a1ba62f33e8cd0a228d07136.zip
fix: Hide "Create templates folder" option if templates are disabled in configuration
When both `skeletondirectory` and `templatedirectory` are set to empty strings in configuration, templates folder creation should be disabled and no Create templates folder option should be present in new folder menu. Related: https://github.com/nextcloud/server/issues/39266 Related: https://github.com/nextcloud/server/issues/46455 Author-Change-Id: IB#1156403 Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl> Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Controller/ViewController.php1
-rw-r--r--apps/files/src/newMenu/newTemplatesFolder.ts6
2 files changed, 5 insertions, 2 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 4dd9f4141e2..2c242040731 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -194,6 +194,7 @@ class ViewController extends Controller {
$this->eventDispatcher->dispatchTyped(new LoadViewer());
}
+ $this->initialState->provideInitialState('templates_enabled', ($this->config->getSystemValueString('skeletondirectory', '') !== '') || ($this->config->getSystemValueString('templatedirectory', '') !== ''));
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
diff --git a/apps/files/src/newMenu/newTemplatesFolder.ts b/apps/files/src/newMenu/newTemplatesFolder.ts
index 43a6f08b525..bf6862bda08 100644
--- a/apps/files/src/newMenu/newTemplatesFolder.ts
+++ b/apps/files/src/newMenu/newTemplatesFolder.ts
@@ -17,7 +17,9 @@ import PlusSvg from '@mdi/svg/svg/plus.svg?raw'
import axios from '@nextcloud/axios'
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 })
/**
@@ -57,8 +59,8 @@ export const entry = {
iconSvgInline: PlusSvg,
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