Set the list identifier when creating a new task

This commit is contained in:
kolaente 2020-07-01 11:17:18 +02:00
parent 1181039249
commit 556ccd68c1
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -392,6 +392,10 @@ func getRemindersForTasks(taskIDs []int64) (reminders []*TaskReminder, err error
return
}
func (t *Task) setIdentifier(list *List) {
t.Identifier = list.Identifier + "-" + strconv.FormatInt(t.Index, 10)
}
// This function takes a map with pointers and returns a slice with pointers to tasks
// It adds more stuff like assignees/labels/etc to a bunch of tasks
func addMoreInfoToTasks(taskMap map[int64]*Task) (err error) {
@ -490,7 +494,7 @@ func addMoreInfoToTasks(taskMap map[int64]*Task) (err error) {
task.RelatedTasks = make(RelatedTaskMap)
// Build the task identifier from the list identifier and task index
task.Identifier = lists[task.ListID].Identifier + "-" + strconv.FormatInt(task.Index, 10)
task.setIdentifier(lists[task.ListID])
}
// Get all related tasks
@ -632,6 +636,8 @@ func createTask(t *Task, a web.Auth, updateAssignees bool) (err error) {
metrics.UpdateCount(1, metrics.TaskCountKey)
t.setIdentifier(l)
err = updateListLastUpdated(&List{ID: t.ListID})
return
}