Skip to content
Open
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
1 change: 1 addition & 0 deletions apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public function index($dir = '', $view = '', $fileid = null) {
$this->initialState->provideInitialState('templates_enabled', ($this->config->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton') !== '') || ($this->config->getSystemValueString('templatedirectory', \OC::$SERVERROOT . '/core/skeleton/Templates') !== ''));
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
$this->initialState->provideInitialState('integration_local_client_enabled', ($this->config->getSystemValueBool('web_ui_integration_local_client_enabled', true)));

$isTwoFactorEnabled = false;
foreach ($this->twoFactorRegistry->getProviderStates($user) as $providerId => $providerState) {
Expand Down
8 changes: 8 additions & 0 deletions apps/files/src/actions/openLocallyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import axios from '@nextcloud/axios'
import LaptopSvg from '@mdi/svg/svg/laptop.svg?raw'
import IconWeb from '@mdi/svg/svg/web.svg?raw'
import { isPublicShare } from '@nextcloud/sharing/public'
import { loadState } from '@nextcloud/initial-state'

const integrationLocalClientEnabled = loadState('files', 'integration_local_client_enabled', true)

export const action = new FileAction({
id: 'edit-locally',
Expand All @@ -20,6 +23,11 @@ export const action = new FileAction({

// Only works on single files
enabled(nodes: Node[]) {
// Only works when enabled.
if (!integrationLocalClientEnabled) {
return false
}

// Only works on single node
if (nodes.length !== 1) {
return false
Expand Down
4 changes: 2 additions & 2 deletions apps/files/tests/Controller/ViewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ public function testTwoFactorAuthEnabled(): void {
'backup_codes' => true,
]);

$invokedCountProvideInitialState = $this->exactly(9);
$invokedCountProvideInitialState = $this->exactly(10);
$this->initialState->expects($invokedCountProvideInitialState)
->method('provideInitialState')
->willReturnCallback(function ($key, $data) use ($invokedCountProvideInitialState) {
if ($invokedCountProvideInitialState->numberOfInvocations() === 9) {
if ($invokedCountProvideInitialState->numberOfInvocations() === 10) {
$this->assertEquals('isTwoFactorEnabled', $key);
$this->assertTrue($data);
}
Expand Down
7 changes: 7 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2740,4 +2740,11 @@
* Defaults to ``true``
*/
'enable_lazy_objects' => true,

/**
* Enables web UI integration with local client.
*
* Defaults to ``true``
*/
'web_ui_integration_local_client_enabled' => true,
];
4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-init.js.map

Large diffs are not rendered by default.

Loading