summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Controller/ViewController.php2
-rw-r--r--apps/files/templates/index.php2
-rw-r--r--apps/files/tests/Controller/ViewControllerTest.php2
-rw-r--r--apps/files_sharing/appinfo/info.xml2
-rw-r--r--apps/files_sharing/appinfo/update.php6
-rw-r--r--apps/files_sharing/lib/Capabilities.php4
-rw-r--r--apps/files_sharing/lib/Migration.php15
-rw-r--r--apps/files_sharing/tests/CapabilitiesTest.php18
-rw-r--r--apps/files_sharing/tests/MigrationTest.php28
9 files changed, 49 insertions, 30 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index d3708915273..6f74fec861f 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -235,8 +235,6 @@ class ViewController extends Controller {
$params['owner'] = $storageInfo['owner'];
$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'];
$params['isPublic'] = false;
- $params['mailNotificationEnabled'] = $this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no');
- $params['mailPublicNotificationEnabled'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no');
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
$user = $this->userSession->getUser()->getUID();
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 17958d330b7..1670ccfd138 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -16,8 +16,6 @@
<input type="hidden" name="ownerDisplayName" id="ownerDisplayName" value="<?php p($_['ownerDisplayName']); ?>" />
<input type="hidden" name="fileNotFound" id="fileNotFound" value="<?php p($_['fileNotFound']); ?>" />
<?php if (!$_['isPublic']) :?>
-<input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" />
-<input type="hidden" name="mailPublicNotificationEnabled" id="mailPublicNotificationEnabled" value="<?php p($_['mailPublicNotificationEnabled']) ?>" />
<input type="hidden" name="allowShareWithLink" id="allowShareWithLink" value="<?php p($_['allowShareWithLink']) ?>" />
<input type="hidden" name="defaultFileSorting" id="defaultFileSorting" value="<?php p($_['defaultFileSorting']) ?>" />
<input type="hidden" name="defaultFileSortingDirection" id="defaultFileSortingDirection" value="<?php p($_['defaultFileSortingDirection']) ?>" />
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php
index 179aaa373b3..25445567ea9 100644
--- a/apps/files/tests/Controller/ViewControllerTest.php
+++ b/apps/files/tests/Controller/ViewControllerTest.php
@@ -218,8 +218,6 @@ class ViewControllerTest extends TestCase {
'defaultFileSortingDirection' => 'asc',
'showHiddenFiles' => 0,
'fileNotFound' => 0,
- 'mailNotificationEnabled' => 'no',
- 'mailPublicNotificationEnabled' => 'no',
'allowShareWithLink' => 'yes',
'appNavigation' => $nav,
'appContents' => [
diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml
index 133119feabd..cc97f65a5e6 100644
--- a/apps/files_sharing/appinfo/info.xml
+++ b/apps/files_sharing/appinfo/info.xml
@@ -10,7 +10,7 @@ Turning the feature off removes shared files and folders on the server for all s
<licence>AGPL</licence>
<author>Michael Gapczynski, Bjoern Schiessle</author>
<default_enable/>
- <version>1.1.0</version>
+ <version>1.1.1</version>
<types>
<filesystem/>
</types>
diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php
index d53d878881e..ed0d7732b37 100644
--- a/apps/files_sharing/appinfo/update.php
+++ b/apps/files_sharing/appinfo/update.php
@@ -26,7 +26,11 @@ $installedVersion = \OC::$server->getConfig()->getAppValue('files_sharing', 'ins
// Migration OC8.2 -> OC9
if (version_compare($installedVersion, '0.9.1', '<')) {
- $m = new Migration(\OC::$server->getDatabaseConnection());
+ $m = new Migration(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig());
$m->removeReShares();
$m->updateInitiatorInfo();
}
+
+if (version_compare($installedVersion, '1.1.1', '<')) {
+ $m = new Migration(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig());
+}
diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php
index 9da6dbbc995..bfbd15c1122 100644
--- a/apps/files_sharing/lib/Capabilities.php
+++ b/apps/files_sharing/lib/Capabilities.php
@@ -73,10 +73,10 @@ class Capabilities implements ICapability {
}
$res["public"] = $public;
- $res['user']['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no') === 'yes';
-
$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
+ $res['user']['send_mail'] = false;
+
$res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
}
diff --git a/apps/files_sharing/lib/Migration.php b/apps/files_sharing/lib/Migration.php
index 9c971bf7f49..605a11fd22c 100644
--- a/apps/files_sharing/lib/Migration.php
+++ b/apps/files_sharing/lib/Migration.php
@@ -27,6 +27,7 @@ namespace OCA\Files_Sharing;
use Doctrine\DBAL\Connection;
use OCP\ICache;
+use OCP\IConfig;
use OCP\IDBConnection;
use OC\Cache\CappedMemoryCache;
@@ -41,14 +42,18 @@ class Migration {
/** @var IDBConnection */
private $connection;
+ /** @var IConfig */
+ private $config;
+
/** @var ICache with all shares we already saw */
private $shareCache;
/** @var string */
private $table = 'share';
- public function __construct(IDBConnection $connection) {
+ public function __construct(IDBConnection $connection, IConfig $config) {
$this->connection = $connection;
+ $this->config = $config;
// We cache up to 10k share items (~20MB)
$this->shareCache = new CappedMemoryCache(10000);
@@ -111,6 +116,14 @@ class Migration {
}
/**
+ * this was dropped for Nextcloud 11 in favour of share by mail
+ */
+ public function removeSendMailOption() {
+ $this->config->deleteAppValue('core', 'shareapi_allow_mail_notification');
+ $this->config->deleteAppValue('core', 'shareapi_allow_public_notification');
+ }
+
+ /**
* find the owner of a re-shared file/folder
*
* @param array $share
diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php
index 254f7cdaa7c..3d59b1f6f34 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -188,24 +188,6 @@ class CapabilitiesTest extends \Test\TestCase {
$this->assertFalse($result['public']['send_mail']);
}
- public function testUserSendMail() {
- $map = [
- ['core', 'shareapi_enabled', 'yes', 'yes'],
- ['core', 'shareapi_allow_mail_notification', 'no', 'yes'],
- ];
- $result = $this->getResults($map);
- $this->assertTrue($result['user']['send_mail']);
- }
-
- public function testUserNoSendMail() {
- $map = [
- ['core', 'shareapi_enabled', 'yes', 'yes'],
- ['core', 'shareapi_allow_mail_notification', 'no', 'no'],
- ];
- $result = $this->getResults($map);
- $this->assertFalse($result['user']['send_mail']);
- }
-
public function testResharing() {
$map = [
['core', 'shareapi_enabled', 'yes', 'yes'],
diff --git a/apps/files_sharing/tests/MigrationTest.php b/apps/files_sharing/tests/MigrationTest.php
index 7d6ca7840ed..572f64da743 100644
--- a/apps/files_sharing/tests/MigrationTest.php
+++ b/apps/files_sharing/tests/MigrationTest.php
@@ -39,6 +39,9 @@ class MigrationTest extends TestCase {
/** @var \OCP\IDBConnection */
private $connection;
+ /** @var \OCP\IConfig */
+ private $config;
+
/** @var Migration */
private $migration;
@@ -48,7 +51,8 @@ class MigrationTest extends TestCase {
parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection();
- $this->migration = new Migration($this->connection);
+ $this->config = \OC::$server->getConfig();
+ $this->migration = new Migration($this->connection, $this->config);
$this->cleanDB();
}
@@ -351,4 +355,26 @@ class MigrationTest extends TestCase {
$stmt->closeCursor();
$this->assertEquals(1001, $i);
}
+
+ /**
+ * test that we really remove the "shareapi_allow_mail_notification" setting only
+ */
+ public function testRemoveSendMailOption() {
+ $this->config->setAppValue('core', 'shareapi_setting1', 'dummy-value');
+ $this->config->setAppValue('core', 'shareapi_allow_mail_notification', 'no');
+ $this->config->setAppValue('core', 'shareapi_allow_public_notification', 'no');
+
+ $this->migration->removeSendMailOption();
+
+ $this->assertNull(
+ $this->config->getAppValue('core', 'shareapi_allow_mail_notification', null)
+ );
+ $this->assertNull(
+ $this->config->getAppValue('core', 'shareapi_allow_public_notification', null)
+ );
+
+ $this->assertSame('dummy-value',
+ $this->config->getAppValue('core', 'shareapi_setting1', null)
+ );
+ }
}