Merge pull request #841 from nextcloud/fix/823
Prevent read-only calendar as default calendar
This commit is contained in:
commit
fb153a0db4
2 changed files with 7 additions and 2 deletions
|
@ -111,7 +111,7 @@ export default {
|
|||
collections: state => state.collections.collections
|
||||
}),
|
||||
...mapGetters({
|
||||
calendars: 'getSortedCalendars'
|
||||
calendars: 'getSortedWritableCalendars'
|
||||
})
|
||||
},
|
||||
methods:
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue