Fix favorite tasks for related tasks
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
790ecfef87
commit
783bda514f
|
@ -622,7 +622,7 @@ func getTaskReminderMap(s *xorm.Session, taskIDs []int64) (taskReminders map[int
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func addRelatedTasksToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]*Task) (err error) {
|
func addRelatedTasksToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]*Task, a web.Auth) (err error) {
|
||||||
relatedTasks := []*TaskRelation{}
|
relatedTasks := []*TaskRelation{}
|
||||||
err = s.In("task_id", taskIDs).Find(&relatedTasks)
|
err = s.In("task_id", taskIDs).Find(&relatedTasks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -645,10 +645,16 @@ func addRelatedTasksToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taskFavorites, err := getFavorites(s, relatedTaskIDs, a, FavoriteKindTask)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: while it certainly be possible to run this function on fullRelatedTasks again, we don't do this for performance reasons.
|
// NOTE: while it certainly be possible to run this function on fullRelatedTasks again, we don't do this for performance reasons.
|
||||||
|
|
||||||
// Go through all task relations and put them into the task objects
|
// Go through all task relations and put them into the task objects
|
||||||
for _, rt := range relatedTasks {
|
for _, rt := range relatedTasks {
|
||||||
|
fullRelatedTasks[rt.OtherTaskID].IsFavorite = taskFavorites[rt.OtherTaskID]
|
||||||
taskMap[rt.TaskID].RelatedTasks[rt.RelationKind] = append(taskMap[rt.TaskID].RelatedTasks[rt.RelationKind], fullRelatedTasks[rt.OtherTaskID])
|
taskMap[rt.TaskID].RelatedTasks[rt.RelationKind] = append(taskMap[rt.TaskID].RelatedTasks[rt.RelationKind], fullRelatedTasks[rt.OtherTaskID])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,7 +735,7 @@ func addMoreInfoToTasks(s *xorm.Session, taskMap map[int64]*Task, a web.Auth) (e
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all related tasks
|
// Get all related tasks
|
||||||
err = addRelatedTasksToTasks(s, taskIDs, taskMap)
|
err = addRelatedTasksToTasks(s, taskIDs, taskMap, a)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ func SetupTests() {
|
||||||
"buckets",
|
"buckets",
|
||||||
"saved_filters",
|
"saved_filters",
|
||||||
"subscriptions",
|
"subscriptions",
|
||||||
|
"favorites",
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue