Skip to content

Commit e6a46cb

Browse files
Merge pull request #61742 from nextcloud/backport/61483/stable34
[stable34] fix(dav): Always show example content section
2 parents 6ebb1d8 + 794aae5 commit e6a46cb

4 files changed

Lines changed: 8 additions & 39 deletions

File tree

apps/dav/lib/Settings/ExampleContentSettings.php

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use OCA\DAV\AppInfo\Application;
1212
use OCA\DAV\Service\ExampleContactService;
1313
use OCA\DAV\Service\ExampleEventService;
14-
use OCP\App\IAppManager;
1514
use OCP\AppFramework\Http\TemplateResponse;
1615
use OCP\AppFramework\Services\IAppConfig;
1716
use OCP\AppFramework\Services\IInitialState;
@@ -22,38 +21,17 @@ class ExampleContentSettings implements ISettings {
2221
public function __construct(
2322
private readonly IAppConfig $appConfig,
2423
private readonly IInitialState $initialState,
25-
private readonly IAppManager $appManager,
2624
private readonly ExampleEventService $exampleEventService,
2725
private readonly ExampleContactService $exampleContactService,
2826
) {
2927
}
3028

3129
#[\Override]
3230
public function getForm(): TemplateResponse {
33-
$calendarEnabled = $this->appManager->isEnabledForUser('calendar');
34-
$contactsEnabled = $this->appManager->isEnabledForUser('contacts');
35-
$this->initialState->provideInitialState('calendarEnabled', $calendarEnabled);
36-
$this->initialState->provideInitialState('contactsEnabled', $contactsEnabled);
37-
38-
if ($calendarEnabled) {
39-
$enableDefaultEvent = $this->exampleEventService->shouldCreateExampleEvent();
40-
$this->initialState->provideInitialState('create_example_event', $enableDefaultEvent);
41-
$this->initialState->provideInitialState(
42-
'has_custom_example_event',
43-
$this->exampleEventService->hasCustomExampleEvent(),
44-
);
45-
}
46-
47-
if ($contactsEnabled) {
48-
$this->initialState->provideInitialState(
49-
'enableDefaultContact',
50-
$this->exampleContactService->isDefaultContactEnabled(),
51-
);
52-
$this->initialState->provideInitialState(
53-
'hasCustomDefaultContact',
54-
$this->appConfig->getAppValueBool('hasCustomDefaultContact'),
55-
);
56-
}
31+
$this->initialState->provideInitialState('create_example_event', $this->exampleEventService->shouldCreateExampleEvent());
32+
$this->initialState->provideInitialState('has_custom_example_event', $this->exampleEventService->hasCustomExampleEvent());
33+
$this->initialState->provideInitialState('enableDefaultContact', $this->exampleContactService->isDefaultContactEnabled());
34+
$this->initialState->provideInitialState('hasCustomDefaultContact', $this->appConfig->getAppValueBool('hasCustomDefaultContact'));
5735

5836
Util::addStyle(Application::APP_ID, 'settings-admin-example-content');
5937
Util::addScript(Application::APP_ID, 'settings-admin-example-content');
@@ -62,11 +40,6 @@ public function getForm(): TemplateResponse {
6240

6341
#[\Override]
6442
public function getSection(): ?string {
65-
if (!$this->appManager->isEnabledForUser('contacts')
66-
&& !$this->appManager->isEnabledForUser('calendar')) {
67-
return null;
68-
}
69-
7043
return 'groupware';
7144
}
7245

apps/dav/src/views/ExampleContentSettingsSection.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@
44
-->
55

66
<script setup lang="ts">
7-
import { loadState } from '@nextcloud/initial-state'
87
import { t } from '@nextcloud/l10n'
98
import { NcSettingsSection } from '@nextcloud/vue'
109
import ExampleContactSettings from '../components/ExampleContactSettings.vue'
1110
import ExampleEventSettings from '../components/ExampleEventSettings.vue'
12-
13-
const hasContactsApp = loadState('dav', 'contactsEnabled')
14-
const hasCalendarApp = loadState('dav', 'calendarEnabled')
1511
</script>
1612

1713
<template>
1814
<NcSettingsSection
1915
id="example-content"
2016
:name="t('dav', 'Example content')"
2117
:description="t('dav', 'Example content serves to showcase the features of Nextcloud. Default content is shipped with Nextcloud, and can be replaced by custom content.')">
22-
<ExampleContactSettings v-if="hasContactsApp" />
23-
<ExampleEventSettings v-if="hasCalendarApp" />
18+
<ExampleContactSettings />
19+
<ExampleEventSettings />
2420
</NcSettingsSection>
2521
</template>

0 commit comments

Comments
 (0)