caldav: return SupportedComponentSet in PROPFIND

I started using this project to export tasks over CalDav, more
specifically to Reminders on iOS/macOS. I quickly realized that
even if you specify that `SupportedComponentSet` contains `VTODO`, that
isn't reflected properly when doing the `PROPFIND`.

This patch should fix that, while keeping the behaviour of defaulting to
`VEVENT` for propfind. Also added some tests to make sure that I didn't
break anything (Which I hope I didn't 😅).
This commit is contained in:
Dan Berglund
2023-07-03 10:47:34 +02:00
committed by GitHub
parent 150f74a6f0
commit 46dbba12fe
2 changed files with 96 additions and 3 deletions

View File

@@ -525,10 +525,16 @@ func (b *backend) propFindCalendar(ctx context.Context, propfind *internal.PropF
}, nil
},
supportedCalendarComponentSetName: func(*internal.RawXMLValue) (interface{}, error) {
components := []comp{}
if cal.SupportedComponentSet != nil {
for _, name := range cal.SupportedComponentSet {
components = append(components, comp{Name: name})
}
} else {
components = append(components, comp{Name: ical.CompEvent})
}
return &supportedCalendarComponentSet{
Comp: []comp{
{Name: ical.CompEvent},
},
Comp: components,
}, nil
},
}