aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2021-01-19 16:38:51 +0100
committerJulius Härtl <jus@bitgrid.net>2021-01-28 12:00:20 +0100
commit4f90766ba314171bbfc78d1e988307c50633e7f3 (patch)
treef5f910ff0f3dd2ff8fa5a05c8fd1f905ffc21ba5 /apps/files/lib
parent7e6d69d166cbc92fb457fc72efc9abe850a0bbe4 (diff)
downloadnextcloud-server-4f90766ba314171bbfc78d1e988307c50633e7f3.tar.gz
nextcloud-server-4f90766ba314171bbfc78d1e988307c50633e7f3.zip
Skip template picker if none available
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/Controller/TemplateController.php12
-rw-r--r--apps/files/lib/Controller/ViewController.php2
2 files changed, 7 insertions, 7 deletions
diff --git a/apps/files/lib/Controller/TemplateController.php b/apps/files/lib/Controller/TemplateController.php
index 08a324a46ec..5a163343223 100644
--- a/apps/files/lib/Controller/TemplateController.php
+++ b/apps/files/lib/Controller/TemplateController.php
@@ -64,12 +64,12 @@ class TemplateController extends OCSController {
*/
public function path(string $templatePath = '', bool $copySystemTemplates = false) {
try {
- $this->templateManager->setTemplatePath($templatePath);
- if ($copySystemTemplates) {
- $this->templateManager->initializeTemplateDirectory($templatePath);
- }
- return new DataResponse();
- } catch (GenericFileException $e) {
+ $templatePath = $this->templateManager->initializeTemplateDirectory($templatePath, null, $copySystemTemplates);
+ return new DataResponse([
+ 'template_path' => $templatePath,
+ 'templates' => $this->templateManager->listCreators()
+ ]);
+ } catch (\Exception $e) {
throw new OCSForbiddenException($e->getMessage());
}
}
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 846ec14c4aa..aade5a5b44a 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -294,7 +294,7 @@ class ViewController extends Controller {
if (class_exists(LoadViewer::class)) {
$this->eventDispatcher->dispatchTyped(new LoadViewer());
}
- $this->initialState->provideInitialState('template_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : null);
+ $this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : null);
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
$params = [];