Skip to content

Commit

Permalink
fix(editor): don't respect default calendar in the calendar picker
Browse files Browse the repository at this point in the history
The default calendar URL from the backend is more restrictive as it is
primarily meant for incoming invitations. This commit effectively
reverts the editor's calendar picker default choice to how it behaved
before v4.7.0.

Signed-off-by: Richard Steinmetz <[email protected]>
  • Loading branch information
st3iny committed May 10, 2024
1 parent 6512456 commit 4f2caf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/components/AppNavigation/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<li v-if="currentUserPrincipal && defaultCalendarOptions.length > 1 && nextcloudVersion >= 29"
class="settings-fieldset-interior-item settings-fieldset-interior-item--default-calendar">
<label :for="defaultCalendarPickerId">
{{ $t('calendar', 'Default calendar for invitations and new events') }}
{{ $t('calendar', 'Default calendar for incoming invitations') }}

Check warning on line 79 in src/components/AppNavigation/Settings.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings.vue#L79

Added line #L79 was not covered by tests
</label>
<CalendarPicker :value="defaultCalendar"
:calendars="defaultCalendarOptions"
Expand Down Expand Up @@ -300,7 +300,7 @@ export default {
.filter(calendar => !calendar.readOnly && !calendar.isSharedWithMe)
},
/**
* The default calendar for new events and inivitations
* The default calendar for incoming inivitations

Check warning on line 303 in src/components/AppNavigation/Settings.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppNavigation/Settings.vue#L303

Added line #L303 was not covered by tests
*
* @return {object|undefined} The default calendar or undefined if none is available
*/
Expand Down Expand Up @@ -443,7 +443,7 @@ export default {
}
},
/**
* Changes the default calendar for new events
* Changes the default calendar for incoming invitations
*
* @param {object} selectedCalendar The new selected default calendar
*/
Expand Down
16 changes: 2 additions & 14 deletions src/store/calendarObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,20 +352,8 @@ const actions = {
vObject.undirtify()
}

// TODO: remove version check once Nextcloud 28 is not supported anymore
let defaultCalendar
const nextcloudVersion = parseInt(OC.config.version.split('.')[0])
if (nextcloudVersion >= 29) {
// Don't select the default calendar by default on Nextcloud < 29 as it can't be
// configured by the user and might lead to confusion
const defaultCalendarUrl = context.getters.getCurrentUserPrincipal.scheduleDefaultCalendarUrl
defaultCalendar = context.getters.getCalendarByUrl(defaultCalendarUrl)
}

return Promise.resolve(mapCalendarJsToCalendarObject(
calendar,
defaultCalendar?.id ?? context.getters.sortedCalendars[0].id,
))
const firstCalendar = context.getters.sortedCalendars[0].id
return Promise.resolve(mapCalendarJsToCalendarObject(calendar, firstCalendar))

Check warning on line 356 in src/store/calendarObjects.js

View check run for this annotation

Codecov / codecov/patch

src/store/calendarObjects.js#L355-L356

Added lines #L355 - L356 were not covered by tests
},

/**
Expand Down

0 comments on commit 4f2caf6

Please sign in to comment.