mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-17 21:12:14 +01:00
fix: Properly get empty template for direct editing
Signed-off-by: Julius Knorr <jus@bitgrid.net>
This commit is contained in:
parent
41f6a2253b
commit
cb664d63be
2 changed files with 9 additions and 3 deletions
|
|
@ -121,8 +121,13 @@ describe('Direct editing (legacy)', function() {
|
|||
createNewFileDirectEditingLink(randUser, 'mynewfile.odt', emptyTemplate.id)
|
||||
.then((token) => {
|
||||
cy.logout()
|
||||
cy.visit(token)
|
||||
cy.visit(token, {
|
||||
onBeforeLoad(win) {
|
||||
cy.spy(win, 'postMessage').as('postMessage')
|
||||
},
|
||||
})
|
||||
cy.waitForCollabora(false)
|
||||
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })
|
||||
cy.screenshot('direct-new')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -94,16 +94,17 @@ class DirectViewController extends Controller {
|
|||
}
|
||||
|
||||
$wopi = null;
|
||||
$template = $direct->getTemplateId() ? $this->templateManager->getTemplateSource($direct->getTemplateId()) : null;
|
||||
$template = $direct->getTemplateId() ? $this->templateManager->get($direct->getTemplateId()) : null;
|
||||
|
||||
if ($template !== null) {
|
||||
$wopi = $this->tokenManager->generateWopiTokenForTemplate($template, $item->getId(), $direct->getUid(), false, true);
|
||||
}
|
||||
|
||||
if ($wopi === null) {
|
||||
$urlSrc = $this->tokenManager->getUrlSrc($item);
|
||||
$wopi = $this->tokenManager->generateWopiToken((string)$item->getId(), null, $direct->getUid(), true);
|
||||
}
|
||||
|
||||
$urlSrc = $this->tokenManager->getUrlSrc($item);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Failed to generate token for existing file on direct editing', ['exception' => $e]);
|
||||
return $this->renderErrorPage('Failed to open the requested file.');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue