Skip to content
Snippets Groups Projects
Unverified Commit b53a484d authored by blizzz's avatar blizzz Committed by GitHub
Browse files

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

Hide card for apps store if disabled
parents 48bdd322 e44b58ed
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -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');
}
......
......@@ -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() {
......
......@@ -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({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment