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
1 changed files with 6 additions and 5 deletions
Showing only changes of commit 891ae88c86 - Show all commits

View File

@ -403,16 +403,17 @@ 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 {
listTasks = tasks
vcls.list.Tasks = tasks
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{