Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/calendar.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2022-10-31 14:06:21 +0300
committerGitHub <noreply@github.com>2022-10-31 14:06:21 +0300
commit9efe190f72ed99d86c1e6842240a85c704c87015 (patch)
tree40a0a8e8e48a00336e505d2777c276714b34532c
parent95c07189d5747871338d38084978e752bccdfdb4 (diff)
parent15e41c2f5a434a8848214ae9294c50485fd3385d (diff)
Merge pull request #4573 from ibpl/main-IB#1126265
Added parameter to hide option for calendar subscription via link
-rw-r--r--lib/Controller/PublicViewController.php3
-rw-r--r--lib/Controller/ViewController.php3
-rw-r--r--src/components/AppNavigation/CalendarList/CalendarListNew.vue9
-rw-r--r--src/store/settings.js7
-rw-r--r--src/views/Calendar.vue2
-rw-r--r--tests/javascript/unit/store/settings.test.js6
-rw-r--r--tests/php/unit/Controller/PublicViewControllerTest.php3
7 files changed, 30 insertions, 3 deletions
diff --git a/lib/Controller/PublicViewController.php b/lib/Controller/PublicViewController.php
index 168625c4..3f10efe5 100644
--- a/lib/Controller/PublicViewController.php
+++ b/lib/Controller/PublicViewController.php
@@ -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(),
diff --git a/lib/Controller/ViewController.php b/lib/Controller/ViewController.php
index 4bfd0edb..78181cc1 100644
--- a/lib/Controller/ViewController.php
+++ b/lib/Controller/ViewController.php
@@ -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');
}
diff --git a/src/components/AppNavigation/CalendarList/CalendarListNew.vue b/src/components/AppNavigation/CalendarList/CalendarListNew.vue
index 683ffb36..593cc4ad 100644
--- a/src/components/AppNavigation/CalendarList/CalendarListNew.vue
+++ b/src/components/AppNavigation/CalendarList/CalendarListNew.vue
@@ -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) {
diff --git a/src/store/settings.js b/src/store/settings.js
index bf6305b9..1ffc9371 100644
--- a/src/store/settings.js
+++ b/src/store/settings.js
@@ -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
},
/**
diff --git a/src/views/Calendar.vue b/src/views/Calendar.vue
index 73c9ff76..1805cde7 100644
--- a/src/views/Calendar.vue
+++ b/src/views/Calendar.vue
@@ -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')
diff --git a/tests/javascript/unit/store/settings.test.js b/tests/javascript/unit/store/settings.test.js
index 4cf12e0f..12d40d58 100644
--- a/tests/javascript/unit/store/settings.test.js
+++ b/tests/javascript/unit/store/settings.test.js
@@ -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,
})
})
diff --git a/tests/php/unit/Controller/PublicViewControllerTest.php b/tests/php/unit/Controller/PublicViewControllerTest.php
index 4245a331..d601f7e9 100644
--- a/tests/php/unit/Controller/PublicViewControllerTest.php
+++ b/tests/php/unit/Controller/PublicViewControllerTest.php
@@ -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'],