From 9a8b3619119fed6dd137545ba54deea30528265f Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <roeland@famdouma.nl>
Date: Sun, 5 Jan 2020 15:54:35 +0100
Subject: Do not show e-mail suggestions if link shares are disabled

For #17774

This removes the e-mail suggestions from the share input if link shares
are disabled. As e-mail shares use just link shares.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
---
 apps/files_sharing/src/components/SharingInput.vue | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'apps/files_sharing/src/components/SharingInput.vue')

diff --git a/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue
index bcb69703548..6b597267de8 100644
--- a/apps/files_sharing/src/components/SharingInput.vue
+++ b/apps/files_sharing/src/components/SharingInput.vue
@@ -132,7 +132,7 @@ export default {
 				return t('files_sharing', 'Name, federated cloud ID or email address …')
 			}
 
-			return 	t('files_sharing', 'Name …')
+			return t('files_sharing', 'Name …')
 		},
 
 		isValidQuery() {
@@ -184,6 +184,20 @@ export default {
 				lookup = true
 			}
 
+			const shareType = [
+				this.SHARE_TYPES.SHARE_TYPE_USER,
+				this.SHARE_TYPES.SHARE_TYPE_GROUP,
+				this.SHARE_TYPES.SHARE_TYPE_REMOTE,
+				this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP,
+				this.SHARE_TYPES.SHARE_TYPE_CIRCLE,
+				this.SHARE_TYPES.SHARE_TYPE_ROOM,
+				this.SHARE_TYPES.SHARE_TYPE_GUEST,
+			]
+
+			if (OC.getCapabilities()['files_sharing']['public']['enabled'] === true) {
+				shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL)
+			}
+
 			const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', {
 				params: {
 					format: 'json',
@@ -191,6 +205,7 @@ export default {
 					search,
 					lookup,
 					perPage: this.config.maxAutocompleteResults,
+					shareType,
 				},
 			})
 
-- 
cgit v1.2.3

