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
1 change: 0 additions & 1 deletion apps/files_sharing/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
'OCA\\Files_Sharing\\Helper' => $baseDir . '/../lib/Helper.php',
'OCA\\Files_Sharing\\Hooks' => $baseDir . '/../lib/Hooks.php',
'OCA\\Files_Sharing\\ISharedStorage' => $baseDir . '/../lib/ISharedStorage.php',
'OCA\\Files_Sharing\\Listener\\GlobalShareAcceptanceListener' => $baseDir . '/../lib/Listener/GlobalShareAcceptanceListener.php',
'OCA\\Files_Sharing\\Listener\\LoadAdditionalListener' => $baseDir . '/../lib/Listener/LoadAdditionalListener.php',
'OCA\\Files_Sharing\\Listener\\LoadSidebarListener' => $baseDir . '/../lib/Listener/LoadSidebarListener.php',
'OCA\\Files_Sharing\\Listener\\UserShareAcceptanceListener' => $baseDir . '/../lib/Listener/UserShareAcceptanceListener.php',
Expand Down
1 change: 0 additions & 1 deletion apps/files_sharing/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
'OCA\\Files_Sharing\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php',
'OCA\\Files_Sharing\\ISharedStorage' => __DIR__ . '/..' . '/../lib/ISharedStorage.php',
'OCA\\Files_Sharing\\Listener\\GlobalShareAcceptanceListener' => __DIR__ . '/..' . '/../lib/Listener/GlobalShareAcceptanceListener.php',
'OCA\\Files_Sharing\\Listener\\LoadAdditionalListener' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalListener.php',
'OCA\\Files_Sharing\\Listener\\LoadSidebarListener' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarListener.php',
'OCA\\Files_Sharing\\Listener\\UserShareAcceptanceListener' => __DIR__ . '/..' . '/../lib/Listener/UserShareAcceptanceListener.php',
Expand Down
46 changes: 23 additions & 23 deletions apps/files_sharing/js/dist/files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/personal-settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/personal-settings.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion apps/files_sharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ protected function registerEventsScripts(IEventDispatcher $dispatcher) {
$dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function() {
\OCP\Util::addScript('files_sharing', 'dist/collaboration');
});
$dispatcher->addServiceListener(ShareCreatedEvent::class, GlobalShareAcceptanceListener::class);
$dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class);

// notifications api to accept incoming user shares
Expand Down
63 changes: 0 additions & 63 deletions apps/files_sharing/lib/Listener/GlobalShareAcceptanceListener.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

namespace OCA\Files_Sharing\Listener;

use OCA\Files_Sharing\AppInfo\Application;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\IConfig;
Expand Down Expand Up @@ -74,7 +75,9 @@ public function handle(Event $event): void {
}

private function handleAutoAccept(IShare $share, string $userId) {
if ($this->config->getUserValue($userId, 'files_sharing','default_accept','no') === 'yes') {
$defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
$acceptDefault = $this->config->getUserValue($userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
if (!$this->config->getSystemValueBool('sharing.force_share_accept', false) && $acceptDefault) {
$this->shareManager->acceptShare($share, $userId);
}
}
Expand Down
7 changes: 5 additions & 2 deletions apps/files_sharing/lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ public function __construct(IConfig $config, IInitialStateService $initialState,
}

public function getForm(): TemplateResponse {
$value = $this->config->getUserValue($this->userId, Application::APP_ID, 'default_accept', 'no') === 'yes';
$this->initialState->provideInitialState(Application::APP_ID, 'accept_default', $value);
$defaultAcceptSystemConfig = $this->config->getSystemValueBool('sharing.enable_share_accept', false) ? 'no' : 'yes';
$acceptDefault = $this->config->getUserValue($this->userId, Application::APP_ID, 'default_accept', $defaultAcceptSystemConfig) === 'yes';
$enforceAccept = $this->config->getSystemValueBool('sharing.force_share_accept', false);
$this->initialState->provideInitialState(Application::APP_ID, 'accept_default', $acceptDefault);
$this->initialState->provideInitialState(Application::APP_ID, 'enforce_accept', $enforceAccept);
return new TemplateResponse('files_sharing', 'Settings/personal');
}

Expand Down
8 changes: 3 additions & 5 deletions apps/files_sharing/src/components/PersonalSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-->

<template>
<div id="files-sharing-personal-settings" class="section">
<div id="files-sharing-personal-settings" class="section" v-if="!enforceAcceptShares">
<h2>{{ t('files', 'Sharing') }}</h2>
<p>
<input id="files-sharing-personal-settings-accept"
Expand All @@ -42,12 +42,10 @@ export default {
name: 'PersonalSettings',
data() {
return {
accepting: true,
accepting: loadState('files_sharing', 'accept_default'),
enforceAcceptShares: loadState('files_sharing', 'enforce_accept'),
}
},
mounted() {
this.accepting = loadState('files_sharing', 'accept_default')
},
methods: {
toggleEnabled() {
axios.put(
Expand Down
13 changes: 9 additions & 4 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,11 +1339,16 @@
'sharing.minSearchStringLength' => 0,

/**
* Starting with Nextcloud 18 also internal shares have to be accepted. Setting
* this setting to true forces all internal shares to be accepted directly.
* (resulting in pre 18 behavior).
* Set to true to enable that internal shares need to be accepted by the users by default.
* Users can change this for their account in their personal sharing settings
*/
'sharing.interal_shares_accepted' => false,
'sharing.enable_share_accept' => false,

/**
* Set to true to enforce that internal shares need to be accepted
*/
'sharing.force_share_accept' => false,


/**
* All other configuration options
Expand Down