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
8 changes: 8 additions & 0 deletions apps/files/lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ConfigLexicon implements ILexicon {
public const GROUP_RECENT_FILES = 'group_recent_files';
public const RECENT_FILES_GROUP_MIME_TYPES = 'recent_files_group_mime_types';
public const RECENT_FILES_GROUP_TIMESPAN_MINUTES = 'recent_files_group_timespan_minutes';
public const LOCAL_CLIENT_INTEGRATION = 'local_client_integration';

#[\Override]
public function getStrictness(): Strictness {
Expand Down Expand Up @@ -71,6 +72,13 @@ public function getAppConfigs(): array {
definition: 'Time window in minutes to group files uploaded close together in the recent files list',
lazy: false,
),
new Entry(
self::LOCAL_CLIENT_INTEGRATION,
ValueType::BOOL,
defaultRaw: true,
definition: 'Whether to enable local client integration',
lazy: false,
),
];
}

Expand Down
1 change: 1 addition & 0 deletions apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public function index($dir = '', $view = '', $fileid = null) {
$this->initialState->provideInitialState('templates_enabled', true);
$this->initialState->provideInitialState('templates_path', $this->templateManager->hasTemplateDirectory() ? $this->templateManager->getTemplatePath() : false);
$this->initialState->provideInitialState('templates', $this->templateManager->listCreators());
$this->initialState->provideInitialState('localClientEnabled', $this->appConfig->getAppValueBool(ConfigLexicon::LOCAL_CLIENT_INTEGRATION));

$isTwoFactorEnabled = false;
foreach ($this->twoFactorRegistry->getProviderStates($user) as $providerId => $providerState) {
Expand Down
7 changes: 7 additions & 0 deletions apps/files/src/actions/openLocallyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ import IconWeb from '@mdi/svg/svg/web.svg?raw'
import { getCurrentUser } from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import { DialogBuilder, showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import { encodePath } from '@nextcloud/paths'
import { generateOcsUrl } from '@nextcloud/router'
import { isPublicShare } from '@nextcloud/sharing/public'
import { logger } from '../utils/logger.ts'
import { isSyncable } from '../utils/permissions.ts'

const localClientEnabled = loadState('files', 'localClientEnabled', true)

export const action: IFileAction = {
id: 'edit-locally',
displayName: () => t('files', 'Open locally'),
Expand All @@ -34,6 +37,10 @@ export const action: IFileAction = {
return false
}

if (!localClientEnabled) {
return false
}

return isSyncable(nodes[0]!)
},

Expand Down
12 changes: 5 additions & 7 deletions apps/files/tests/Controller/ViewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,11 @@ public function testTwoFactorAuthEnabled(): void {
'backup_codes' => true,
]);

$invokedCountProvideInitialState = $this->exactly(13);
$this->initialState->expects($invokedCountProvideInitialState)
$initialStates = [];
$this->initialState->expects(self::atLeast(13))
->method('provideInitialState')
->willReturnCallback(function ($key, $data) use ($invokedCountProvideInitialState): void {
if ($invokedCountProvideInitialState->numberOfInvocations() === 13) {
$this->assertEquals('isTwoFactorEnabled', $key);
$this->assertTrue($data);
}
->willReturnCallback(function ($key, $data) use (&$initialStates): void {
$initialStates[$key] = $data;
});

$this->config
Expand All @@ -324,5 +321,6 @@ public function testTwoFactorAuthEnabled(): void {
]);

$this->viewController->index('', '', null);
$this->assertTrue($initialStates['isTwoFactorEnabled'] ?? false);
}
}
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