Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-10-18 18:30:46 +0300
committerGitHub <noreply@github.com>2016-10-18 18:30:46 +0300
commitbd081a202c5e198ed7231c3ec275f77df9d40b10 (patch)
tree591fbf929ae6952d1272ca4c1e387f27999e9a82
parentec6affaa59a18b533515a936980fe8a2b411388c (diff)
parente7cb4ac96328c30902e974a280bd861a4a7f5e96 (diff)
Merge pull request #26364 from owncloud/stable8.2-fix-unsharefromself-hookvalues
[stable8.2] Fix post_unshareFromSelf hook parameter format
-rw-r--r--apps/files_sharing/tests/groupetagpropagation.php22
-rw-r--r--lib/private/share/share.php4
2 files changed, 24 insertions, 2 deletions
diff --git a/apps/files_sharing/tests/groupetagpropagation.php b/apps/files_sharing/tests/groupetagpropagation.php
index 804d064eadb..e541ced48f9 100644
--- a/apps/files_sharing/tests/groupetagpropagation.php
+++ b/apps/files_sharing/tests/groupetagpropagation.php
@@ -101,4 +101,26 @@ class GroupEtagPropagation extends PropagationTestCase {
$this->assertAllUnchanged();
}
+
+ public function testRecipientUnsharesFromSelf() {
+ $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
+ $this->assertTrue(
+ $this->rootView->unlink('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test')
+ );
+ $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER2]);
+
+ $this->assertAllUnchanged();
+ }
+
+ public function testRecipientUnsharesFromSelfUniqueGroupShare() {
+ $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
+ // rename to create an extra entry in the share table
+ $this->rootView->rename('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test', '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test_renamed');
+ $this->assertTrue(
+ $this->rootView->unlink('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test_renamed')
+ );
+ $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER2]);
+
+ $this->assertAllUnchanged();
+ }
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 004f0c4905b..e0bb3e10ac0 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -1038,7 +1038,7 @@ class Share extends Constants {
if (isset($groupShare['file_target'])) {
$shareTmp['fileTarget'] = $groupShare['file_target'];
}
- $listOfUnsharedItems = array_merge($listOfUnsharedItems, array($groupShare));
+ $listOfUnsharedItems = array_merge($listOfUnsharedItems, array($shareTmp));
$itemUnshared = true;
} elseif (!$itemUnshared && isset($uniqueGroupShare)) {
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `permissions` = ? WHERE `id` = ?');
@@ -1053,7 +1053,7 @@ class Share extends Constants {
if (isset($uniqueGroupShare['file_target'])) {
$shareTmp['fileTarget'] = $uniqueGroupShare['file_target'];
}
- $listOfUnsharedItems = array_merge($listOfUnsharedItems, array($uniqueGroupShare));
+ $listOfUnsharedItems = array_merge($listOfUnsharedItems, array($shareTmp));
$itemUnshared = true;
}