Merge branch 'main' into 1274_import_caldav_categories
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
cernst 2023-03-01 21:43:15 +00:00
commit 3f7409aa56
2 changed files with 7 additions and 2 deletions

View File

@ -1612,7 +1612,7 @@ func (t *Task) Delete(s *xorm.Session, a web.Auth) (err error) {
// @Router /tasks/{ID} [get]
func (t *Task) ReadOne(s *xorm.Session, a web.Auth) (err error) {
*t, err = GetTaskSimple(s, t)
*t, err = GetTaskByIDSimple(s, t.ID)
if err != nil {
return
}

View File

@ -212,7 +212,7 @@ func (vcls *VikunjaCaldavListStorage) GetResource(rpath string) (*data.Resource,
// save and override the updated unix date to not break any later etag checks
updated := vcls.task.Updated
err := vcls.task.ReadOne(s, vcls.user)
tasks, err := models.GetTasksByUIDs(s, []string{vcls.task.UID}, vcls.user)
if err != nil {
_ = s.Rollback()
if models.IsErrTaskDoesNotExist(err) {
@ -224,6 +224,11 @@ func (vcls *VikunjaCaldavListStorage) GetResource(rpath string) (*data.Resource,
return nil, false, err
}
if len(tasks) < 1 {
return nil, false, errs.ResourceNotFoundError
}
vcls.task = tasks[0]
if updated.Unix() > 0 {
vcls.task.Updated = updated
}