]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle case if no share-by-mail share provider is loaded
authorBjoern Schiessle <bjoern@schiessle.org>
Mon, 24 Oct 2016 15:04:40 +0000 (17:04 +0200)
committerBjoern Schiessle <bjoern@schiessle.org>
Tue, 1 Nov 2016 18:54:40 +0000 (19:54 +0100)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
apps/files_sharing/lib/Controller/ShareAPIController.php
apps/files_sharing/lib/Controller/ShareesAPIController.php
core/js/sharedialogview.js

index f9c7d69cf5f04200c1044fba91b295f837bc2a05..0f4173f87636679e175edd5c1064fd808b970b53 100644 (file)
@@ -23,6 +23,7 @@
  */
 namespace OCA\Files_Sharing\Controller;
 
+use OC\Share20\Exception\ProviderException;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\OCS\OCSBadRequestException;
 use OCP\AppFramework\OCS\OCSException;
@@ -556,7 +557,11 @@ class ShareAPIController extends OCSController {
                $userShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_USER, $path, $reshares, -1, 0);
                $groupShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, $path, $reshares, -1, 0);
                $linkShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_LINK, $path, $reshares, -1, 0);
-               $mailShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_EMAIL, $path, $reshares, -1, 0);
+               if ($this->shareManager->shareProviderExists(\OCP\Share::SHARE_TYPE_EMAIL)) {
+                       $mailShares = $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_EMAIL, $path, $reshares, -1, 0);
+               } else {
+                       $mailShares = [];
+               }
                $shares = array_merge($userShares, $groupShares, $linkShares, $mailShares);
 
                if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
index d5d877f4673d97a48d84beceb4aefcc84d7e2a6d..4af332a118491c6c057ef50e1c47e500b2c03d98 100644 (file)
@@ -446,6 +446,11 @@ class ShareesAPIController extends OCSController {
                        $shareTypes = array_diff($shareTypes, [Share::SHARE_TYPE_REMOTE]);
                }
 
+               if (!$this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) {
+                       // Remove mail shares from type array, because the share provider is not loaded
+                       $shareTypes = array_diff($shareTypes, [Share::SHARE_TYPE_EMAIL]);
+               }
+
                $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
                $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
                $this->limit = (int) $perPage;
index 30cb0b1fbfd5b5c328cf8a91e4753d8c780e45a6..c22d9469da8d0df36266ca977599bcfb80d237dc 100644 (file)
                                                var users   = result.ocs.data.exact.users.concat(result.ocs.data.users);
                                                var groups  = result.ocs.data.exact.groups.concat(result.ocs.data.groups);
                                                var remotes = result.ocs.data.exact.remotes.concat(result.ocs.data.remotes);
-                                               var emails = result.ocs.data.exact.emails.concat(result.ocs.data.emails);
+                                               if (typeof(result.ocs.data.emails) !== 'undefined') {
+                                                       var emails = result.ocs.data.exact.emails.concat(result.ocs.data.emails);
+                                               } else {
+                                                       var emails = [];
+                                               }
 
                                                var usersLength;
                                                var groupsLength;