Merge pull request #52950 from nextcloud/backport/50464/stable30

pull/53063/head
Louis 2025-05-21 12:41:44 +07:00 committed by GitHub
commit de44c65637
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 12 deletions

@ -191,6 +191,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());

@ -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

@ -288,8 +288,9 @@ $CONFIG = [
/**
* The directory where the skeleton files are located. These files will be
* copied to the data directory of new users. Leave empty to not copy any
* skeleton files.
* copied to the data directory of new users. Set empty string to not copy any
* skeleton files. If unset and templatedirectory is empty string, shipped
* templates will be used to create a template directory for the user.
* ``{lang}`` can be used as a placeholder for the language of the user.
* If the directory does not exist, it falls back to non dialect (from ``de_DE``
* to ``de``). If that does not exist either, it falls back to ``default``
@ -298,18 +299,16 @@ $CONFIG = [
*/
'skeletondirectory' => '/path/to/nextcloud/core/skeleton',
/**
* The directory where the template files are located. These files will be
* copied to the template directory of new users. Leave empty to not copy any
* copied to the template directory of new users. Set empty string to not copy any
* template files.
* ``{lang}`` can be used as a placeholder for the language of the user.
* If the directory does not exist, it falls back to non dialect (from ``de_DE``
* to ``de``). If that does not exist either, it falls back to ``default``
*
* If this is not set creating a template directory will only happen if no custom
* ``skeletondirectory`` is defined, otherwise the shipped templates will be used
* to create a template directory for the user.
* To disable creating a template directory, set both skeletondirectory and
* templatedirectory to empty strings.
*/
'templatedirectory' => '/path/to/nextcloud/templates',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long