Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ public function getCapabilities() {
array_push($optionalMimetypes, ...self::MIMETYPES_MSOFFICE);
}

// If version is too old, draw is not supported
if (!$this->capabilitiesService->hasDrawSupport()) {
$defaultMimetypes = array_diff($defaultMimetypes, [
'application/vnd.oasis.opendocument.graphics',
'application/vnd.oasis.opendocument.graphics-flat-xml',
]);
}

if (!$this->appManager->isEnabledForUser('files_pdfviewer')) {
$defaultMimetypes[] = 'application/pdf';
$optionalMimetypes = array_diff($optionalMimetypes, ['application/pdf']);
Expand All @@ -134,7 +126,7 @@ public function getCapabilities() {
$this->capabilities = [
'richdocuments' => [
'version' => $this->appManager->getAppVersion('richdocuments'),
'mimetypes' => array_values($defaultMimetypes),
'mimetypes' => $defaultMimetypes,
'mimetypesNoDefaultOpen' => array_values($optionalMimetypes),
'mimetypesSecureView' => $this->config->useSecureViewAdditionalMimes() ? self::SECURE_VIEW_ADDITIONAL_MIMES : [],
'collabora' => $collaboraCapabilities,
Expand Down
3 changes: 0 additions & 3 deletions lib/Listener/RegisterTemplateFileCreatorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public function handle(Event $event): void {
return $odpType;
});

if (!$this->capabilitiesService->hasDrawSupport()) {
return;
}
$templateManager->registerTemplateFileCreator(function () use ($ooxml, $appPath) {
$odpType = new TemplateFileCreator('richdocuments', $this->l10n->t('New diagram'), '.odg');
$odpType->addMimetype('application/vnd.oasis.opendocument.graphics');
Expand Down
4 changes: 0 additions & 4 deletions lib/Service/CapabilitiesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ public function hasNextcloudBranding(): bool {
return $this->isVersionAtLeast('21.11');
}

public function hasDrawSupport(): bool {
return $this->isVersionAtLeast('6.4.7');
}

public function hasTemplateSource(): bool {
return $this->getCapabilities()['hasTemplateSource'] ?? false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/InitialStateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function provideCapabilities(): void {
}

$this->initialState->provideInitialState('productName', $this->capabilitiesService->getProductName());
$this->initialState->provideInitialState('hasDrawSupport', $this->capabilitiesService->hasDrawSupport());
$this->initialState->provideInitialState('hasDrawSupport', true);
$this->initialState->provideInitialState('hasNextcloudBranding', $this->capabilitiesService->hasNextcloudBranding());
$this->initialState->provideInitialState('instanceId', $this->config->getSystemValue('instanceid'));
$this->initialState->provideInitialState('wopi_callback_url', $this->appConfig->getNextcloudUrl());
Expand Down
23 changes: 0 additions & 23 deletions tests/lib/Listener/RegisterTemplateFileCreatorListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public function testHandleRegistersTemplateFileCreators() {
$this->permissionManager->method('isEnabledForUser')->willReturn(true);
$this->permissionManager->method('userCanEdit')->willReturn(true);
$this->capabilitiesService->method('getCapabilities')->willReturn(['something']);
$this->capabilitiesService->method('hasDrawSupport')->willReturn(true);
$this->config->method('getAppValue')->willReturn('ooxml');
$this->appManager->method('getAppPath')->willReturn('/tmp');

Expand All @@ -89,28 +88,6 @@ public function testHandleRegistersTemplateFileCreators() {
$listener->handle($event);
}

public function testHandleRegistersWithoutDrawSupport() {
$event = $this->createMock(RegisterTemplateCreatorEvent::class);
$event->method('getTemplateManager')->willReturn($this->templateManager);
$this->permissionManager->method('isEnabledForUser')->willReturn(true);
$this->permissionManager->method('userCanEdit')->willReturn(true);
$this->capabilitiesService->method('getCapabilities')->willReturn(['something']);
$this->capabilitiesService->method('hasDrawSupport')->willReturn(false);
$this->config->method('getAppValue')->willReturn('ooxml');
$this->appManager->method('getAppPath')->willReturn('/tmp');

$this->templateManager->expects($this->exactly(3))->method('registerTemplateFileCreator');

$listener = new RegisterTemplateFileCreatorListener(
$this->l10n,
$this->config,
$this->appManager,
$this->capabilitiesService,
$this->permissionManager
);
$listener->handle($event);
}

public function testHandleDoesNotRegisterIfUserCannotEdit() {
$event = $this->createMock(RegisterTemplateCreatorEvent::class);
$event->method('getTemplateManager')->willReturn($this->templateManager);
Expand Down
Loading