diff --git a/frontend/src/api/calendars.js b/frontend/src/api/calendars.js index 9143758b5..5ff05962b 100644 --- a/frontend/src/api/calendars.js +++ b/frontend/src/api/calendars.js @@ -51,7 +51,9 @@ export default { data ) }, - + deleteUserEvent(calendarPk, eventId) { + return repository.delete(`/user-calendars/${calendarPk}/events/${eventId}/`) + }, getAttendees() { return repository.get('/attendees/') }, diff --git a/frontend/src/components/calendars/CalendarForm.vue b/frontend/src/components/calendars/CalendarForm.vue index 168497494..2f2fd3e94 100644 --- a/frontend/src/components/calendars/CalendarForm.vue +++ b/frontend/src/components/calendars/CalendarForm.vue @@ -109,7 +109,7 @@ async function submit() { props.initialCalendar && props.initialCalendar.color !== calendar.value.color ) { - emit('colorChanged', calendar.value) + emit('colorChanged', calendar.value.pk) } close() busStore.displayNotification({ diff --git a/frontend/src/components/calendars/EventForm.vue b/frontend/src/components/calendars/EventForm.vue index cd7f7708d..91bf3a1f4 100644 --- a/frontend/src/components/calendars/EventForm.vue +++ b/frontend/src/components/calendars/EventForm.vue @@ -81,6 +81,14 @@ + + {{ $gettext('Delete') }} + {{ $gettext('Close') }} @@ -109,7 +117,7 @@ const props = defineProps({ default: null, }, }) -const emit = defineEmits(['close']) +const emit = defineEmits(['close', 'refreshCalendar']) const { $gettext } = useGettext() const busStore = useBusStore() @@ -170,16 +178,26 @@ async function saveEvent() { try { var data = JSON.parse(JSON.stringify(form.value)) if (!props.event) { - api.createUserEvent(form.value.calendar, data).then(() => { - busStore.displayNotification({ msg: $gettext('Event added') }) - close() - }) + await api.createUserEvent(form.value.calendar, data) + busStore.displayNotification({ msg: $gettext('Event added') }) } else { - api.patchUserEvent(form.value.calendar, props.event.id, data).then(() => { - busStore.displayNotification({ msg: $gettext('Event updated') }) - close() - }) + await api.patchUserEvent(form.value.calendar, props.event.id, data) + busStore.displayNotification({ msg: $gettext('Event updated') }) } + emit('refreshCalendar', data.calendar) + close() + } finally { + working.value = false + } +} + +async function deleteEvent() { + working.value = true + try { + await api.deleteUserEvent(form.value.calendar, props.event.id) + busStore.displayNotification({ msg: $gettext('Event deleted') }) + emit('refreshCalendar', form.value.calendar) + close() } finally { working.value = false } diff --git a/frontend/src/components/calendars/ImportEventsForm.vue b/frontend/src/components/calendars/ImportEventsForm.vue index 18a3e71bb..5f2efc8d4 100644 --- a/frontend/src/components/calendars/ImportEventsForm.vue +++ b/frontend/src/components/calendars/ImportEventsForm.vue @@ -84,7 +84,7 @@ async function sendFile() { response.data.counter ) busStore.displayNotification({ msg }) - emit('eventsImported', props.calendar) + emit('eventsImported', props.calendar.pk) } catch (err) { onSendError(err.response) } finally { diff --git a/frontend/src/views/calendars/CalendarView.vue b/frontend/src/views/calendars/CalendarView.vue index 347a4bb08..94f81d5d1 100644 --- a/frontend/src/views/calendars/CalendarView.vue +++ b/frontend/src/views/calendars/CalendarView.vue @@ -18,6 +18,7 @@ @@ -183,9 +184,9 @@ function fetchUserCalendars() { }) } -function refreshCalendarEvents(calendar) { +function refreshCalendarEvents(calendarPk) { const fullc = calendarRef.value.getApi() - const evtSource = fullc.getEventSourceById(`user-${calendar.pk}`) + const evtSource = fullc.getEventSourceById(`user-${calendarPk}`) evtSource.refetch() } diff --git a/modoboa/core/commands/templates/settings.py.tpl b/modoboa/core/commands/templates/settings.py.tpl index a0670515c..2d4c8d85b 100644 --- a/modoboa/core/commands/templates/settings.py.tpl +++ b/modoboa/core/commands/templates/settings.py.tpl @@ -198,7 +198,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media') OAUTH2_PROVIDER = { 'OIDC_ENABLED': True, 'OIDC_RP_INITIATED_LOGOUT_ENABLED': True, - 'OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT': True, + 'OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT': False, 'OIDC_RSA_PRIVATE_KEY': env.str('OIDC_RSA_PRIVATE_KEY', multiline=True), 'SCOPES': { 'openid': 'OpenID Connect scope', diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index c815583ad..441d410ab 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -215,7 +215,7 @@ dTnvCVtA59ne4LEVie/PMH/odQWY0SxVm/76uBZv/1vY OAUTH2_PROVIDER = { "OIDC_ENABLED": True, "OIDC_RP_INITIATED_LOGOUT_ENABLED": True, - "OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT": True, + "OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT": False, "OIDC_RSA_PRIVATE_KEY": OIDC_RSA_PRIVATE_KEY, # PROD : os.environ.get("OIDC_RSA_PRIVATE_KEY"), "SCOPES": { "openid": "OpenID Connect scope",