feat(caldav): Import Labels from caldav categories
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
cernst 2023-02-27 23:24:01 +01:00
parent ea0a62fbe2
commit 95ba1b3bd6
2 changed files with 5 additions and 19 deletions

View File

@ -548,19 +548,6 @@ func GetTaskSimple(s *xorm.Session, t *Task) (task Task, err error) {
return
}
// GetTask returns a task with extra data
func GetTask(s *xorm.Session, t *Task, a web.Auth) (task Task, err error) {
task = *t
task, err = GetTaskSimple(s, t)
if err != nil {
return
}
taskMap := make(map[int64]*Task, 1)
taskMap[task.ID] = &task
err = addMoreInfoToTasks(s, taskMap, a)
return
}
// GetTasksByIDs returns all tasks for a list of ids
func (bt *BulkTask) GetTasksByIDs(s *xorm.Session) (err error) {
for _, id := range bt.IDs {
@ -1625,12 +1612,12 @@ 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) {
taskMap := make(map[int64]*Task, 1)
taskMap[t.ID] = &Task{}
*taskMap[t.ID], err = GetTaskByIDSimple(s, t.ID)
*t, err = GetTaskSimple(s, t)
if err != nil {
return
}
taskMap := make(map[int64]*Task, 1)
taskMap[t.ID] = t
err = addMoreInfoToTasks(s, taskMap, a)
if err != nil {

View File

@ -210,7 +210,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
task, err := models.GetTask(s, &models.Task{ID: vcls.task.ID, UID: vcls.task.UID}, vcls.user)
err := vcls.task.ReadOne(s, vcls.user)
if err != nil {
_ = s.Rollback()
if models.IsErrTaskDoesNotExist(err) {
@ -222,14 +222,13 @@ func (vcls *VikunjaCaldavListStorage) GetResource(rpath string) (*data.Resource,
return nil, false, err
}
vcls.task = &task
if updated.Unix() > 0 {
vcls.task.Updated = updated
}
rr := VikunjaListResourceAdapter{
list: vcls.list,
task: &task,
task: vcls.task,
}
r := data.NewResource(rpath, &rr)
return &r, true, nil