Merge pull request #911 from nextcloud/fix/908

Don't break app by subscribed calendars
This commit is contained in:
Raimund Schlüßler 2020-03-08 16:20:54 +01:00 committed by GitHub
commit 48296f079b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,