From: Sam Tuke Date: Thu, 31 Jan 2013 16:30:37 +0000 (+0000) Subject: Merge github.com:owncloud/core X-Git-Tag: v5.0.0alpha1~112^2~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31e723a907399d7d33a0699da082164055f79b3e;p=nextcloud-server.git Merge github.com:owncloud/core Conflicts: lib/public/share.php --- 31e723a907399d7d33a0699da082164055f79b3e diff --cc lib/public/share.php index 5fd1e2e29f3,3c5c2d53782..9894f1550a8 --- a/lib/public/share.php +++ b/lib/public/share.php @@@ -456,22 -341,7 +341,14 @@@ class Share * @return Returns true on success or false on failure */ public static function unshare($itemType, $itemSource, $shareType, $shareWith) { - $item = self::getItems($itemType, - $itemSource, - $shareType, - $shareWith, - \OC_User::getUser(), - self::FORMAT_NONE, - null, - 1); - if ($item) { + if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) { + // Pass all the vars we have for now, they may be useful + \OC_Hook::emit('OCP\Share', 'pre_unshare', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'shareType' => $shareType, + 'shareWith' => $shareWith, - )); ++ )); self::delete($item['id']); return true; } @@@ -485,14 -355,7 +362,13 @@@ * @return Returns true on success or false on failure */ public static function unshareAll($itemType, $itemSource) { - $shares = self::getItemShared($itemType, $itemSource); - if ($shares) { + if ($shares = self::getItemShared($itemType, $itemSource)) { + // Pass all the vars we have for now, they may be useful + \OC_Hook::emit('OCP\Share', 'pre_unshareAll', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'shares' => $shares - )); ++ )); foreach ($shares as $share) { self::delete($share['id']); } @@@ -959,6 -758,15 +771,15 @@@ continue; } } + + // Add display names to result + if ( isset($row['share_with']) && $row['share_with'] != '') { + $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']); + } - if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { - $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']); ++ if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { ++ $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']); + } + $items[$row['id']] = $row; } if (!empty($items)) {