Merge pull request #2428 from nextcloud/disable-links-to-install-apps-if-no-appstore

fix(3rd-party apps): do not link to maps/recognize install page if the appstore isn't enabled
This commit is contained in:
Thomas Citharel 2024-04-15 11:52:19 +02:00 committed by GitHub
commit 7208122d0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 32 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Thomas Citharel <nextcloud@tcit.fr>
*
* @license AGPL-3.0-or-later
*
@ -113,6 +114,7 @@ class PageController extends Controller {
$this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true);
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$this->initialState->provideInitialState('showPeopleMenuEntry', $this->config->getAppValue('photos', 'showPeopleMenuEntry', 'true') === 'true');
$this->initialState->provideInitialState('appStoreEnabled', $this->config->getSystemValueBool('appstoreenabled', true));
// Provide user config
foreach (array_keys(UserConfigService::DEFAULT_CONFIGS) as $key) {

View File

@ -2,6 +2,7 @@
- @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
-
- @author John Molakvoæ <skjnldsv@protonmail.com>
- @author Thomas Citharel <nextcloud@tcit.fr>
-
- @license AGPL-3.0-or-later
-
@ -158,6 +159,7 @@ import videoplaceholder from './assets/video.svg'
import areTagsInstalled from './services/AreTagsInstalled.js'
import isMapsInstalled from './services/IsMapsInstalled.js'
import isRecognizeInstalled from './services/IsRecognizeInstalled.js'
import isAppStoreEnabled from './services/IsAppStoreEnabled.js'
import logger from './services/logger.js'
export default {
@ -193,10 +195,10 @@ export default {
showLocationMenuEntry: getCurrentUser() === null
? false
: getCurrentUser().isAdmin || isMapsInstalled,
: (getCurrentUser().isAdmin && isAppStoreEnabled) || isMapsInstalled,
showPeopleMenuEntry: getCurrentUser() === null
? false
: (getCurrentUser().isAdmin && loadState('photos', 'showPeopleMenuEntry', true)) || isRecognizeInstalled,
: (getCurrentUser().isAdmin && loadState('photos', 'showPeopleMenuEntry', true) && isAppStoreEnabled) || isRecognizeInstalled,
openedSettings: false,
}

View File

@ -0,0 +1,26 @@
/**
* @copyright Copyright (c) 2024 Thomas Citharel <nextcloud@tcit.fr>
*
* @author Thomas Citharel <nextcloud@tcit.fr>
*
* @license AGPL-3.0-or-later
*
* 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 appStoreEnabled = loadState('photos', 'appStoreEnabled')
export default appStoreEnabled