Skip to content

Commit

Permalink
Fix Don't show groups in share placeholder if group sharing is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Zishan-7 committed Aug 30, 2021
1 parent da656f5 commit c127cd3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public function index(): TemplateResponse {
$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, 'locales', $locales);
$this->initialStateService->provideInitialState(Application::APP_ID, 'defaultProfile', $defaultProfile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<script>
import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
import client from '../../../services/cdav'
import isGroupSharingEnabled from '../../../services/isGroupSharingEnabled'
import addressBookSharee from './SettingsAddressbookSharee'
import debounce from 'debounce'
Expand Down Expand Up @@ -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')
Expand Down
26 changes: 26 additions & 0 deletions src/services/isGroupSharingEnabled.js
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c127cd3

Please sign in to comment.