fix: partial fix to allow list tasks in ios reminders app
- This addresses the bug where tasks were not being listed properly in certain cases.
This commit is contained in:
@ -52,7 +52,7 @@ type VikunjaCaldavProjectStorage struct {
|
||||
}
|
||||
|
||||
// GetResources returns either all projects, links to the principal, or only one project, depending on the request
|
||||
func (vcls *VikunjaCaldavProjectStorage) GetResources(rpath string, _ bool) ([]data.Resource, error) {
|
||||
func (vcls *VikunjaCaldavProjectStorage) GetResources(rpath string, withChildren bool) ([]data.Resource, error) {
|
||||
|
||||
// It looks like we need to have the same handler for returning both the calendar home set and the user principal
|
||||
// Since the client seems to ignore the whatever is being returned in the first request and just makes a second one
|
||||
@ -92,6 +92,23 @@ func (vcls *VikunjaCaldavProjectStorage) GetResources(rpath string, _ bool) ([]d
|
||||
}
|
||||
r := data.NewResource(rpath, &rr)
|
||||
r.Name = vcls.project.Title
|
||||
|
||||
if withChildren {
|
||||
// If the request is withChildren (Depth: 1), we need to return all tasks of the project
|
||||
var resources []data.Resource
|
||||
resources = append(resources, r)
|
||||
for i := range vcls.project.Tasks {
|
||||
rr := VikunjaProjectResourceAdapter{
|
||||
project: vcls.project,
|
||||
task: &vcls.project.Tasks[i].Task,
|
||||
isCollection: false,
|
||||
}
|
||||
r := data.NewResource(getTaskURL(&vcls.project.Tasks[i].Task), &rr)
|
||||
r.Name = vcls.project.Tasks[i].Title
|
||||
resources = append(resources, r)
|
||||
}
|
||||
return resources, nil
|
||||
}
|
||||
return []data.Resource{r}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user