From c8ad86cd66505b18ba15124db37fcd186c2a8dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Wed, 29 Jan 2020 20:28:00 +0100 Subject: [PATCH 1/2] Return writable calendar as default calendar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- src/store/calendars.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/store/calendars.js b/src/store/calendars.js index 17ab00c7..927cc408 100644 --- a/src/store/calendars.js +++ b/src/store/calendars.js @@ -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 } } From 5fa79e8372c9cf5f256d061f8c92b29e8fe98416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Wed, 29 Jan 2020 20:34:48 +0100 Subject: [PATCH 2/2] Prevent selecting read-only calendar as default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- src/components/TheSettings.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TheSettings.vue b/src/components/TheSettings.vue index c5701ca9..53d4f41e 100644 --- a/src/components/TheSettings.vue +++ b/src/components/TheSettings.vue @@ -111,7 +111,7 @@ export default { collections: state => state.collections.collections }), ...mapGetters({ - calendars: 'getSortedCalendars' + calendars: 'getSortedWritableCalendars' }) }, methods: