Added parameter to hide option for calendar subscription via link
This commit is contained in:
Christoph Wurst 2022-10-31 12:06:21 +01:00 committed by GitHub
commit 9efe190f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 3 deletions

View File

@ -6,6 +6,7 @@ declare(strict_types=1);
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@ -128,6 +129,7 @@ class PublicViewController extends Controller {
$defaultSlotDuration = $this->config->getAppValue($this->appName, 'slotDuration', '00:30:00');
$defaultDefaultReminder = $this->config->getAppValue($this->appName, 'defaultReminder', 'none');
$defaultShowTasks = $this->config->getAppValue($this->appName, 'showTasks', 'yes');
$defaultCanSubscribeLink = $this->config->getAppValue('dav', 'allow_calendar_link_subscriptions', 'yes');
$appVersion = $this->config->getAppValue($this->appName, 'installed_version', null);
@ -146,6 +148,7 @@ class PublicViewController extends Controller {
$this->initialStateService->provideInitialState($this->appName, 'show_tasks', $defaultShowTasks === 'yes');
$this->initialStateService->provideInitialState($this->appName, 'tasks_enabled', false);
$this->initialStateService->provideInitialState($this->appName, 'hide_event_export', false);
$this->initialStateService->provideInitialState($this->appName, 'can_subscribe_link', $defaultCanSubscribeLink);
return new TemplateResponse($this->appName, 'main', [
'share_url' => $this->getShareURL(),

View File

@ -6,6 +6,7 @@ declare(strict_types=1);
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@ -108,6 +109,7 @@ class ViewController extends Controller {
if (!in_array($forceEventAlarmType, ['DISPLAY', 'EMAIL'], true)) {
$forceEventAlarmType = false;
}
$canSubscribeLink = $this->config->getAppValue('dav', 'allow_calendar_link_subscriptions', 'yes') === 'yes';
$talkEnabled = $this->appManager->isEnabledForUser('spreed');
$talkApiVersion = version_compare($this->appManager->getAppVersion('spreed'), '12.0.0', '>=') ? 'v4' : 'v1';
@ -131,6 +133,7 @@ class ViewController extends Controller {
$this->initialStateService->provideInitialState('force_event_alarm_type', $forceEventAlarmType);
$this->initialStateService->provideInitialState('appointmentConfigs', $this->appointmentConfigService->getAllAppointmentConfigurations($this->userId));
$this->initialStateService->provideInitialState('disable_appointments', $disableAppointments);
$this->initialStateService->provideInitialState('can_subscribe_link', $canSubscribeLink);
return new TemplateResponse($this->appName, 'main');
}

View File

@ -1,5 +1,6 @@
<!--
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com>
- @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
-
- @author Georg Ehrke <oc.list@georgehrke.com>
- @author Richard Steinmetz <richard@steinmetz.cloud>
@ -71,7 +72,7 @@
{{ $t('calendar', 'Creating calendar …') }}
</ActionText>
<ActionButton v-if="showCreateSubscriptionLabel"
<ActionButton v-if="showCreateSubscriptionLabel && canSubscribeLink"
@click.prevent.stop="openCreateSubscriptionInput">
<template #icon>
<LinkVariant :size="20" decorative />
@ -109,6 +110,7 @@ import CalendarBlank from 'vue-material-design-icons/CalendarBlank.vue'
import CalendarCheck from 'vue-material-design-icons/CalendarCheck.vue'
import LinkVariant from 'vue-material-design-icons/LinkVariant.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
import { mapState } from 'vuex'
export default {
name: 'CalendarListNew',
@ -140,6 +142,11 @@ export default {
showCreateSubscriptionSaving: false,
}
},
computed: {
...mapState({
canSubscribeLink: state => state.settings.canSubscribeLink,
}),
},
watch: {
isOpen() {
if (this.isOpen) {

View File

@ -1,5 +1,6 @@
/**
* @copyright Copyright (c) 2020 Georg Ehrke
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
@ -45,6 +46,7 @@ const state = {
timezone: 'automatic',
hideEventExport: false,
forceEventAlarmType: false,
canSubscribeLink: true,
// user-defined Nextcloud settings
momentLocale: 'en',
}
@ -149,8 +151,9 @@ const mutations = {
* @param {boolean} data.hideEventExport
* @param {string} data.forceEventAlarmType
* @param {boolean} data.disableAppointments Allow to disable the appointments feature
* @param {boolean} data.canSubscribeLink
*/
loadSettingsFromServer(state, { appVersion, eventLimit, firstRun, showWeekNumbers, showTasks, showWeekends, skipPopover, slotDuration, defaultReminder, talkEnabled, tasksEnabled, timezone, hideEventExport, forceEventAlarmType, disableAppointments }) {
loadSettingsFromServer(state, { appVersion, eventLimit, firstRun, showWeekNumbers, showTasks, showWeekends, skipPopover, slotDuration, defaultReminder, talkEnabled, tasksEnabled, timezone, hideEventExport, forceEventAlarmType, disableAppointments, canSubscribeLink }) {
logInfo(`
Initial settings:
- AppVersion: ${appVersion}
@ -168,6 +171,7 @@ Initial settings:
- HideEventExport: ${hideEventExport}
- ForceEventAlarmType: ${forceEventAlarmType}
- disableAppointments: ${disableAppointments}
- CanSubscribeLink: ${canSubscribeLink}
`)
state.appVersion = appVersion
@ -185,6 +189,7 @@ Initial settings:
state.hideEventExport = hideEventExport
state.forceEventAlarmType = forceEventAlarmType
state.disableAppointments = disableAppointments
state.canSubscribeLink = canSubscribeLink
},
/**

View File

@ -1,5 +1,6 @@
<!--
- @copyright Copyright (c) 2020 Georg Ehrke <oc.list@georgehrke.com>
- @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
- @author Georg Ehrke <oc.list@georgehrke.com>
-
- @license AGPL-3.0-or-later
@ -214,6 +215,7 @@ export default {
hideEventExport: loadState('calendar', 'hide_event_export'),
forceEventAlarmType: loadState('calendar', 'force_event_alarm_type', false),
disableAppointments: loadState('calendar', 'disable_appointments', false),
canSubscribeLink: loadState('calendar', 'can_subscribe_link'),
})
this.$store.dispatch('initializeCalendarJsConfig')

View File

@ -1,5 +1,6 @@
/**
* @copyright Copyright (c) 2019 Georg Ehrke
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
@ -63,6 +64,7 @@ describe('store/settings test suite', () => {
timezone: 'automatic',
momentLocale: 'en',
disableAppointments: false,
canSubscribeLink: true,
})
})
@ -172,6 +174,7 @@ describe('store/settings test suite', () => {
hideEventExport: false,
forceEventAlarmType: false,
disableAppointments: false,
canSubscribeLink: true,
}
const settings = {
@ -191,6 +194,7 @@ describe('store/settings test suite', () => {
hideEventExport: false,
forceEventAlarmType: false,
disableAppointments: false,
canSubscribeLink: true,
}
settingsStore.mutations.loadSettingsFromServer(state, settings)
@ -213,6 +217,7 @@ Initial settings:
- HideEventExport: false
- ForceEventAlarmType: false
- disableAppointments: false
- CanSubscribeLink: true
`)
expect(state).toEqual({
appVersion: '2.1.0',
@ -232,6 +237,7 @@ Initial settings:
hideEventExport: false,
forceEventAlarmType: false,
disableAppointments: false,
canSubscribeLink: true,
})
})

View File

@ -6,6 +6,7 @@ declare(strict_types=1);
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@ -64,7 +65,7 @@ class PublicViewControllerTest extends TestCase {
}
public function testPublicIndexWithBranding():void {
$this->config->expects(self::exactly(10))
$this->config->expects(self::exactly(11))
->method('getAppValue')
->willReturnMap([
['calendar', 'eventLimit', 'yes', 'no'],