[Pkg-owncloud-commits] [owncloud] 327/394: remember which item was switched to which id, so that later the correct item can be unset
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:12:41 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 83105438cad3f7ed3a511386af4a9858d5aad213
Author: Björn Schießle <schiessle at owncloud.com>
Date: Tue Feb 5 19:00:11 2013 +0100
remember which item was switched to which id, so that later the correct item can be unset
---
lib/public/share.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/public/share.php b/lib/public/share.php
index 7d04a3a..9983415 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -724,6 +724,7 @@ class Share {
}
$items = array();
$targets = array();
+ $switchedItems = array();
while ($row = $result->fetchRow()) {
// Filter out duplicate group shares for users with unique targets
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
@@ -748,6 +749,7 @@ class Share {
// Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing
if (~(int)$items[$id]['permissions'] & self::PERMISSION_SHARE && (int)$row['permissions'] & self::PERMISSION_SHARE) {
$items[$row['id']] = $items[$id];
+ $switchedItems[$id] = $row['id'];
unset($items[$id]);
$id = $row['id'];
}
@@ -844,7 +846,11 @@ class Share {
}
}
// Remove collection item
- unset($items[$row['id']]);
+ $toRemove = $row['id'];
+ if (array_key_exists($row['id'], $switchedItems)) {
+ $toRemove = $switchedItems[$toRemove];
+ }
+ unset($items[$toRemove]);
}
}
if (!empty($collectionItems)) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list