Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Controller/PublicViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private function publicIndex(string $token):PublicTemplateResponse {
$defaultShowTasks = $this->config->getAppValue($this->appName, 'showTasks', 'yes');
$defaultTasksSidebar = $this->config->getAppValue($this->appName, 'tasksSidebar', 'yes');
$defaultCanSubscribeLink = $this->config->getAppValue('dav', 'allow_calendar_link_subscriptions', 'yes');
$defaultSendInvitations = $this->config->getAppValue('dav', 'sendInvitations', 'yes');

$appVersion = $this->config->getAppValue($this->appName, 'installed_version', '');

Expand All @@ -110,6 +111,7 @@ private function publicIndex(string $token):PublicTemplateResponse {
$this->initialStateService->provideInitialState($this->appName, 'hide_event_export', false);
$this->initialStateService->provideInitialState($this->appName, 'can_subscribe_link', $defaultCanSubscribeLink);
$this->initialStateService->provideInitialState($this->appName, 'show_resources', false);
$this->initialStateService->provideInitialState($this->appName, 'send_invitations', $defaultSendInvitations);

return new PublicTemplateResponse($this->appName, 'main', [
'share_url' => $this->getShareURL(),
Expand Down
1 change: 0 additions & 1 deletion lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public function __construct(
* @return TemplateResponse
*/
public function index():TemplateResponse {

$this->calendarInitialStateService->run();
return new TemplateResponse($this->appName, 'main');
}
Expand Down
2 changes: 2 additions & 0 deletions lib/Service/CalendarInitialStateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function run(): void {
$forceEventAlarmType = false;
}
$canSubscribeLink = $this->config->getAppValue('dav', 'allow_calendar_link_subscriptions', 'yes') === 'yes';
$sendInvitations = $this->config->getAppValue('dav', 'sendInvitations', 'yes') === 'yes';
$showResources = $this->config->getAppValue($this->appName, 'showResources', 'yes') === 'yes';
$publicCalendars = $this->config->getAppValue($this->appName, 'publicCalendars', '');

Expand Down Expand Up @@ -119,6 +120,7 @@ public function run(): void {
$this->initialStateService->provideInitialState('tasks_enabled', $tasksEnabled);
$this->initialStateService->provideInitialState('hide_event_export', $hideEventExport);
$this->initialStateService->provideInitialState('force_event_alarm_type', $forceEventAlarmType);
$this->initialStateService->provideInitialState('send_invitations', $sendInvitations);
if (!is_null($this->userId)) {
$this->initialStateService->provideInitialState('appointmentConfigs', $this->appointmentConfigService->getAllAppointmentConfigurations($this->userId));
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/Editor/Invitees/InviteesListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Actions v-if="!isReadOnly && isViewedByOrganizer">
<ActionCheckbox
v-if="!members.length"
v-show="sendInvitations"
:modelValue="attendee.rsvp"
@update:modelValue="toggleRSVP">
{{ $t('calendar', 'Request reply') }}
Expand Down Expand Up @@ -127,6 +128,7 @@ import AvatarParticipationStatus from '@/components/Editor/AvatarParticipationSt
import AttendeeDisplay from '@/components/Editor/Invitees/AttendeeDisplay.vue'
import { getAttendeeDetails } from '@/services/attendeeDetails.js'
import useCalendarObjectInstanceStore from '@/store/calendarObjectInstance.js'
import useSettingsStore from '@/store/settings.js'
import { removeMailtoPrefix } from '@/utils/attendee.js'

export default {
Expand Down Expand Up @@ -184,6 +186,7 @@ export default {
computed: {
...mapStores(useCalendarObjectInstanceStore),
...mapState(useCalendarObjectInstanceStore, ['calendarObjectInstance']),
...mapState(useSettingsStore, ['sendInvitations']),
/**
* @return {string}
*/
Expand Down
6 changes: 5 additions & 1 deletion src/store/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default defineStore('settings', {
timezone: 'automatic',
hideEventExport: false,
forceEventAlarmType: false,
sendInvitations: true,
canSubscribeLink: true,
showResources: true,
// user-defined Nextcloud settings
Expand Down Expand Up @@ -347,8 +348,9 @@ export default defineStore('settings', {
* @param {string} data.attachmentsFolder Default user's attachments folder
* @param {boolean} data.showResources Show or hide the resources tab
* @param {string} data.publicCalendars The list of public calendars configured by the administrator
* @param {boolean} data.sendInvitations Whether or not sending invitation e-mails is enabled
*/
loadSettingsFromServer({ appVersion, eventLimit, firstRun, showWeekNumbers, showTasks, showWeekends, skipPopover, slotDuration, defaultReminder, defaultReminderPartDay, defaultReminderFullDay, talkEnabled, tasksEnabled, timezone, hideEventExport, forceEventAlarmType, disableAppointments, tasksSidebar, canSubscribeLink, attachmentsFolder, showResources, publicCalendars }) {
loadSettingsFromServer({ appVersion, eventLimit, firstRun, showWeekNumbers, showTasks, showWeekends, skipPopover, slotDuration, defaultReminder, defaultReminderPartDay, defaultReminderFullDay, talkEnabled, tasksEnabled, timezone, hideEventExport, forceEventAlarmType, disableAppointments, tasksSidebar, canSubscribeLink, attachmentsFolder, showResources, publicCalendars, sendInvitations }) {
logInfo(`
Initial settings:
- AppVersion: ${appVersion}
Expand All @@ -373,6 +375,7 @@ Initial settings:
- attachmentsFolder: ${attachmentsFolder}
- ShowResources: ${showResources}
- PublicCalendars: ${publicCalendars}
- SendInvitations: ${sendInvitations}
`)

this.appVersion = appVersion
Expand All @@ -397,6 +400,7 @@ Initial settings:
this.attachmentsFolder = attachmentsFolder
this.showResources = showResources
this.publicCalendars = publicCalendars
this.sendInvitations = sendInvitations
},

/**
Expand Down
1 change: 1 addition & 0 deletions src/views/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export default {
showResources: loadState('calendar', 'show_resources', true),
publicCalendars: loadState('calendar', 'publicCalendars', []),
tasksSidebar: loadState('calendar', 'tasks_sidebar', true),
sendInvitations: loadState('calendar', 'send_invitations'),
})
this.settingsStore.initializeCalendarJsConfig()

Expand Down
5 changes: 5 additions & 0 deletions tests/javascript/unit/store/settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('store/settings test suite', () => {
showResources: true,
publicCalendars: null,
searchQuery: '',
sendInvitations: true,
})
})

Expand Down Expand Up @@ -91,6 +92,7 @@ describe('store/settings test suite', () => {
attachmentsFolder: '/Calendar',
showResources: true,
publicCalendars: null,
sendInvitations: true,
}

settingsStore.$state = state
Expand Down Expand Up @@ -119,6 +121,7 @@ describe('store/settings test suite', () => {
attachmentsFolder: '/Attachments',
showResources: true,
publicCalendars: null,
sendInvitations: true,
}

settingsStore.loadSettingsFromServer(settings)
Expand Down Expand Up @@ -148,6 +151,7 @@ Initial settings:
- attachmentsFolder: /Attachments
- ShowResources: true
- PublicCalendars: null
- SendInvitations: true
`)
expect(settingsStore.$state).toEqual({
appVersion: '2.1.0',
Expand Down Expand Up @@ -176,6 +180,7 @@ Initial settings:
showResources: true,
publicCalendars: null,
searchQuery: '',
sendInvitations: true,
})
})

Expand Down
12 changes: 8 additions & 4 deletions tests/php/unit/Controller/PublicViewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function setUp():void {
}

public function testPublicIndexWithBranding():void {
$this->config->expects(self::exactly(12))
$this->config->expects(self::exactly(13))
->method('getAppValue')
->willReturnMap([
['calendar', 'eventLimit', 'yes', 'no'],
Expand All @@ -62,6 +62,7 @@ public function testPublicIndexWithBranding():void {
['calendar', 'showTasks', 'yes', 'yes'],
['calendar', 'tasksSidebar', 'yes', 'yes'],
['dav', 'allow_calendar_link_subscriptions', 'yes', 'defaultCanSubscribeLink'],
['dav', 'sendInvitations', 'yes', 'defaultSendInvitations'],
['calendar', 'installed_version', '', '1.0.0']
]);

Expand All @@ -87,7 +88,7 @@ public function testPublicIndexWithBranding():void {
->with('imagePath456')
->willReturn('absoluteImagePath456');

$this->initialStateService->expects(self::exactly(18))
$this->initialStateService->expects(self::exactly(19))
->method('provideInitialState')
->willReturnMap([
['calendar', 'app_version', '1.0.0'],
Expand All @@ -108,6 +109,7 @@ public function testPublicIndexWithBranding():void {
['calendar', 'hide_event_export', false],
['calendar', 'can_subscribe_link', 'defaultCanSubscribeLink'],
['calendar', 'show_resources', false],
['calendar', 'send_invitations', 'defaultSendInvitations'],
]);

$response = $this->controller->publicIndexWithBranding('');
Expand All @@ -132,7 +134,7 @@ public function testRedirectionIfRequestedWithAcceptCalendarHeader(): void {
}

public function testPublicIndexForEmbedding():void {
$this->config->expects(self::exactly(12))
$this->config->expects(self::exactly(13))
->method('getAppValue')
->willReturnMap([
['calendar', 'eventLimit', 'yes', 'yes'],
Expand All @@ -146,6 +148,7 @@ public function testPublicIndexForEmbedding():void {
['calendar', 'showTasks', 'yes', 'defaultShowTasks'],
['calendar', 'tasksSidebar', 'yes', 'defaulttasksSidebar'],
['dav', 'allow_calendar_link_subscriptions', 'yes', 'defaultCanSubscribeLink'],
['dav', 'sendInvitations', 'yes', 'defaultSendInvitations'],
['calendar', 'installed_version', '', '1.0.0']
]);
$this->request->expects(self::once())
Expand Down Expand Up @@ -189,11 +192,12 @@ public function testPublicIndexForEmbedding():void {
['calendar', 'hide_event_export', false],
['calendar', 'can_subscribe_link', 'defaultCanSubscribeLink'],
['calendar', 'show_resources', false],
['calendar', 'send_invitations', 'defaultSendInvitations'],
['calendar', 'is_embed', true],
];
$callIndex = 0;

$this->initialStateService->expects(self::exactly(19))
$this->initialStateService->expects(self::exactly(20))
->method('provideInitialState')
->willReturnCallback(function ($appName, $key, $value) use (&$callIndex, $expectedCalls) {
$this->assertEquals($expectedCalls[$callIndex][0], $appName);
Expand Down
18 changes: 12 additions & 6 deletions tests/php/unit/Service/CalendarInitialStateServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function testRun(): void {
$this->groupManager,
$this->userManager,
);
$this->config->expects(self::exactly(19))
$this->config->expects(self::exactly(20))
->method('getAppValue')
->willReturnMap([
['calendar', 'eventLimit', 'yes', 'defaultEventLimit'],
Expand All @@ -124,6 +124,7 @@ public function testRun(): void {
['calendar', 'disableAppointments', 'no', 'no'],
['calendar', 'forceEventAlarmType', '', 'forceEventAlarmType'],
['dav', 'allow_calendar_link_subscriptions', 'yes', 'no'],
['dav', 'sendInvitations', 'yes', 'yes'],
['calendar', 'showResources', 'yes', 'yes'],
['calendar', 'publicCalendars', ''],
['spreed', 'start_conversations', '[]', '[]'],
Expand Down Expand Up @@ -175,7 +176,7 @@ public function testRun(): void {
->willReturn([$this->createMock(IResourceBackend::class)]);
$this->roomManager->expects(self::never())
->method('getBackends');
$this->initialStateService->expects(self::exactly(29))
$this->initialStateService->expects(self::exactly(30))
->method('provideInitialState')
->willReturnMap([
['app_version', '1.0.0'],
Expand All @@ -198,6 +199,7 @@ public function testRun(): void {
['tasks_enabled', true],
['hide_event_export', true],
['force_event_alarm_type', null],
['send_invitations', true],
['appointmentConfigs', [new AppointmentConfig()]],
['disable_appointments', false],
['can_subscribe_link', false],
Expand Down Expand Up @@ -228,7 +230,7 @@ public function testRunAnonymously(): void {
$this->groupManager,
$this->userManager,
);
$this->config->expects(self::exactly(17))
$this->config->expects(self::exactly(18))
->method('getAppValue')
->willReturnMap([
['calendar', 'eventLimit', 'yes', 'defaultEventLimit'],
Expand All @@ -248,6 +250,7 @@ public function testRunAnonymously(): void {
['calendar', 'disableAppointments', 'no', 'no'],
['calendar', 'forceEventAlarmType', '', 'forceEventAlarmType'],
['dav', 'allow_calendar_link_subscriptions', 'yes', 'no'],
['dav', 'sendInvitations', 'yes', 'yes'],
['calendar', 'showResources', 'yes', 'yes'],
['calendar', 'publicCalendars', ''],
]);
Expand Down Expand Up @@ -293,7 +296,7 @@ public function testRunAnonymously(): void {
$this->roomManager->expects(self::once())
->method('getBackends')
->willReturn([]);
$this->initialStateService->expects(self::exactly(28))
$this->initialStateService->expects(self::exactly(29))
->method('provideInitialState')
->willReturnMap([
['app_version', '1.0.0'],
Expand All @@ -316,6 +319,7 @@ public function testRunAnonymously(): void {
['tasks_enabled', true],
['hide_event_export', true],
['force_event_alarm_type', null],
['send_invitations', true],
['disable_appointments', false],
['can_subscribe_link', false],
['show_resources', true],
Expand Down Expand Up @@ -351,7 +355,7 @@ public function testIndexViewFix(string $savedView, string $expectedView): void
$this->groupManager,
$this->userManager,
);
$this->config->expects(self::exactly(19))
$this->config->expects(self::exactly(20))
->method('getAppValue')
->willReturnMap([
['calendar', 'eventLimit', 'yes', 'defaultEventLimit'],
Expand All @@ -371,6 +375,7 @@ public function testIndexViewFix(string $savedView, string $expectedView): void
['calendar', 'disableAppointments', 'no', 'no'],
['calendar', 'forceEventAlarmType', '', 'forceEventAlarmType'],
['dav', 'allow_calendar_link_subscriptions', 'yes', 'no'],
['dav', 'sendInvitations', 'yes', 'yes'],
['calendar', 'showResources', 'yes', 'yes'],
['calendar', 'publicCalendars', ''],
['spreed', 'start_conversations', '[]', '[]'],
Expand Down Expand Up @@ -423,7 +428,7 @@ public function testIndexViewFix(string $savedView, string $expectedView): void
$this->roomManager->expects(self::once())
->method('getBackends')
->willReturn([$this->createMock(IRoomBackend::class)]);
$this->initialStateService->expects(self::exactly(29))
$this->initialStateService->expects(self::exactly(30))
->method('provideInitialState')
->willReturnMap([
['app_version', '1.0.0'],
Expand All @@ -446,6 +451,7 @@ public function testIndexViewFix(string $savedView, string $expectedView): void
['tasks_enabled', false],
['hide_event_export', true],
['force_event_alarm_type', null],
['send_invitations', true],
['appointmentConfigs', [new AppointmentConfig()]],
['disable_appointments', false],
['can_subscribe_link', false],
Expand Down
Loading