Return writable calendar as default calendar
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
d8a26c7fc8
commit
c8ad86cd66
1 changed files with 6 additions and 1 deletions
|
@ -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