fetch tasks for caldav lists #641

Merged
konrad merged 6 commits from freaktechnik/api:caldav-tasks into master 2020-10-18 10:40:51 +00:00
Showing only changes of commit 891ae88c86 - Show all commits

View File

@ -403,17 +403,18 @@ func (vcls *VikunjaCaldavListStorage) getListRessource(isCollection bool) (rr Vi
tk := models.TaskCollection{
ListID: vcls.list.ID,
}
var iface interface{}
iface, _, _, err = tk.ReadAll(vcls.user, "", 1, 1000)
iface, _, _, err := tk.ReadAll(vcls.user, "", 1, 1000)
if err != nil {
return
}
tasks, ok := iface.([]*models.Task)
if ok {
if !ok {
panic("Tasks returned from TaskCollection.ReadAll are not []*models.Task!")
konrad marked this conversation as resolved Outdated

By design, this should always be true, if it isn't something is wrong with the implementation. Could you add a panic in that case? (In an else) That way it would be catched in the tests if it fails.

By design, this should always be true, if it isn't something is wrong with the implementation. Could you add a `panic` in that case? (In an `else`) That way it would be catched in the tests if it fails.
Review

Done.

Done.
}
listTasks = tasks
vcls.list.Tasks = tasks
}
}
rr = VikunjaListResourceAdapter{
list: vcls.list,