fix: Make sure labels are always exported as caldav #1412

Merged
konrad merged 2 commits from ce72/api:1272_export_labels_single_resource into main 2023-02-28 10:42:58 +00:00
2 changed files with 14 additions and 1 deletions
Showing only changes of commit ea0a62fbe2 - Show all commits

View File

@ -548,6 +548,19 @@ 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 {

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.GetTaskSimple(s, &models.Task{ID: vcls.task.ID, UID: vcls.task.UID})
task, err := models.GetTask(s, &models.Task{ID: vcls.task.ID, UID: vcls.task.UID}, vcls.user)
Review

Please use the ReadOne method of the Task model.

Please use the `ReadOne` method of the `Task` model.
Review

Okay, I understand. Please check again.

Okay, I understand. Please check again.
if err != nil {
_ = s.Rollback()
if models.IsErrTaskDoesNotExist(err) {