Skip to content

Commit

Permalink
Merge pull request #841 from nextcloud/fix/823
Browse files Browse the repository at this point in the history
Prevent read-only calendar as default calendar
  • Loading branch information
raimund-schluessler committed Jan 29, 2020
2 parents d8a26c7 + 5fa79e8 commit fb153a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/TheSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default {
collections: state => state.collections.collections
}),
...mapGetters({
calendars: 'getSortedCalendars'
calendars: 'getSortedWritableCalendars'
})
},
methods:
Expand Down
7 changes: 6 additions & 1 deletion src/store/calendars.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,12 @@ const getters = {
* @returns {Calendar} The default calendar
*/
getDefaultCalendar: (state, getters, rootState) => {
return getters.getCalendarById(rootState.settings.settings.defaultCalendarId) || getters.getSortedCalendars[0]
const defaultCalendar = getters.getCalendarById(rootState.settings.settings.defaultCalendarId)
// If the default calendar is read only we return the first calendar that is writable
if (!defaultCalendar || defaultCalendar.readOnly) {
return getters.getSortedCalendars.find(calendar => !calendar.readOnly) || getters.getSortedCalendars[0]
}
return defaultCalendar
}
}

Expand Down

0 comments on commit fb153a0

Please sign in to comment.