summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZishan-7 <zishan2539@gmail.com>2021-08-30 18:29:28 +0530
committerhamza221 <hamzamahjoubi221@gmail.com>2023-05-22 16:43:19 +0200
commitfb0709f4a4511045c8e009ebc899db3b9f5bda7f (patch)
tree4247078b69ff595e1789990cde5e932d55ea3ffa
parent73ef6e258f363a9bf7f44cd0e79bdff0b44450b4 (diff)
Fix Don't show groups in share placeholder if group sharing is disabled #2242
Signed-off-by: Zishan-7 <zishan2539@gmail.com>
-rw-r--r--lib/Controller/PageController.php3
-rw-r--r--src/components/AppNavigation/Settings/SettingsAddressbookShare.vue7
-rw-r--r--src/services/isGroupSharingEnabled.js26
3 files changed, 35 insertions, 1 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index fcfee915..7cd2e2aa 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -106,7 +106,10 @@ class PageController extends Controller {
$isCirclesEnabled = $this->appManager->isEnabledForUser('circles') === true;
// if circles is not installed, we use 0.0.0
$isCircleVersionCompatible = $this->compareVersion->isCompatible($circleVersion ? $circleVersion : '0.0.0', 22);
+ // Check whether group sharing is enabled or not
+ $isGroupSharingEnabled = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'isGroupSharingEnabled', $isGroupSharingEnabled);
$this->initialStateService->provideInitialState(Application::APP_ID, 'locales', $locales);
$this->initialStateService->provideInitialState(Application::APP_ID, 'defaultProfile', $defaultProfile);
$this->initialStateService->provideInitialState(Application::APP_ID, 'supportedNetworks', $supportedNetworks);
diff --git a/src/components/AppNavigation/Settings/SettingsAddressbookShare.vue b/src/components/AppNavigation/Settings/SettingsAddressbookShare.vue
index 5b072b67..7fdd79c0 100644
--- a/src/components/AppNavigation/Settings/SettingsAddressbookShare.vue
+++ b/src/components/AppNavigation/Settings/SettingsAddressbookShare.vue
@@ -49,6 +49,7 @@
<script>
import { NcSelect } from '@nextcloud/vue'
import client from '../../../services/cdav.js'
+import isGroupSharingEnabled from '../../../services/isGroupSharingEnabled.js'
import addressBookSharee from './SettingsAddressbookSharee.vue'
import debounce from 'debounce'
@@ -79,7 +80,11 @@ export default {
},
computed: {
placeholder() {
- return t('contacts', 'Share with users or groups')
+ if (isGroupSharingEnabled) {
+ return t('contacts', 'Share with users or groups')
+ } else {
+ return t('contacts', 'Share with users')
+ }
},
noResult() {
return t('contacts', 'No users or groups')
diff --git a/src/services/isGroupSharingEnabled.js b/src/services/isGroupSharingEnabled.js
new file mode 100644
index 00000000..b393c08e
--- /dev/null
+++ b/src/services/isGroupSharingEnabled.js
@@ -0,0 +1,26 @@
+/**
+ * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+import { loadState } from '@nextcloud/initial-state'
+
+const isGroupSharingEnabled = loadState('contacts', 'isGroupSharingEnabled', false)
+export default isGroupSharingEnabled