Merge pull request #19968 from nextcloud/enh/noid/hide-apps-store-if-disabled

Hide card for apps store if disabled
This commit is contained in:
blizzz 2020-03-16 22:11:40 +01:00 committed by GitHub
commit b53a484d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@ namespace OCA\WorkflowEngine\Settings;
use OCA\WorkflowEngine\AppInfo\Application;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IL10N;
use OCP\Settings\ISettings;
@ -54,23 +55,31 @@ abstract class ASettings implements ISettings {
/** @var IInitialStateService */
private $initialStateService;
/** @var IConfig */
private $config;
/**
* @param string $appName
* @param IL10N $l
* @param EventDispatcherInterface $eventDispatcher
* @param Manager $manager
* @param IInitialStateService $initialStateService
* @param IConfig $config
*/
public function __construct(
$appName,
IL10N $l,
EventDispatcherInterface $eventDispatcher,
Manager $manager,
IInitialStateService $initialStateService
IInitialStateService $initialStateService,
IConfig $config
) {
$this->appName = $appName;
$this->l10n = $l;
$this->eventDispatcher = $eventDispatcher;
$this->manager = $manager;
$this->initialStateService = $initialStateService;
$this->config = $config;
}
abstract function getScope(): int;
@ -108,6 +117,12 @@ abstract class ASettings implements ISettings {
$this->getScope()
);
$this->initialStateService->provideInitialState(
Application::APP_ID,
'appstoreenabled',
$this->config->getSystemValueBool('appstoreenabled', true)
);
return new TemplateResponse(Application::APP_ID, 'settings', [], 'blank');
}

View File

@ -51,7 +51,6 @@
import Rule from './Rule'
import Operation from './Operation'
import { mapGetters, mapState } from 'vuex'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
const ACTION_LIMIT = 3
@ -66,7 +65,6 @@ export default {
return {
showMoreOperations: false,
appstoreUrl: generateUrl('settings/apps/workflow'),
scope: loadState('workflowengine', 'scope'),
}
},
computed: {
@ -74,6 +72,8 @@ export default {
rules: 'getRules',
}),
...mapState({
appstoreEnabled: 'appstoreEnabled',
scope: 'scope',
operations: 'operations',
}),
hasMoreOperations() {
@ -86,7 +86,7 @@ export default {
return Object.values(this.operations).slice(0, ACTION_LIMIT)
},
showAppStoreHint() {
return this.scope === 0 && OC.isUserAdmin()
return this.scope === 0 && this.appstoreEnabled && OC.isUserAdmin()
},
},
mounted() {

View File

@ -33,6 +33,7 @@ const store = new Vuex.Store({
state: {
rules: [],
scope: loadState('workflowengine', 'scope'),
appstoreEnabled: loadState('workflowengine', 'appstoreenabled'),
operations: loadState('workflowengine', 'operators'),
plugins: Vue.observable({