From e70a8423fa135e33807fd92f8d01d08bf214a532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Sun, 8 Mar 2020 16:17:39 +0100 Subject: [PATCH] Don't break app by subscribed calendars 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/store/calendars.js b/src/store/calendars.js index 312d01da..42a6c685 100644 --- a/src/store/calendars.js +++ b/src/store/calendars.js @@ -88,6 +88,18 @@ export function mapDavCollectionToCalendar(calendar, currentUserPrincipal) { // As fallback if we don't know what color that is supposed to be color = uidToHexColor(displayName) } + + const shares = [] + if (!!currentUserPrincipal && Array.isArray(calendar.shares)) { + for (const share of calendar.shares) { + if (share.href === currentUserPrincipal.principalScheme) { + continue + } + + shares.push(mapDavShareeToSharee(share)) + } + } + return { // get last part of url id: calendar.url.split('/').slice(-2, -1)[0], @@ -99,7 +111,7 @@ export function mapDavCollectionToCalendar(calendar, currentUserPrincipal) { tasks: {}, url: calendar.url, dav: calendar, - shares: calendar.shares.map(sharee => Object.assign({}, mapDavShareeToSharee(sharee))), + shares, supportsTasks: calendar.components.includes('VTODO'), loadedCompleted: false, isSharedWithMe,