1
0

feat(reminders): include project in reminder notification

This commit is contained in:
kolaente
2023-10-20 13:56:14 +02:00
parent b2b4b5423f
commit 66cf7ab50a
4 changed files with 53 additions and 17 deletions

View File

@ -132,10 +132,24 @@ func RegisterOverdueReminderCron() {
log.Debugf("[Undone Overdue Tasks Reminder] Sending reminders to %d users", len(uts))
taskIDs := []int64{}
for _, ut := range uts {
for _, t := range ut.tasks {
taskIDs = append(taskIDs, t.ID)
}
}
projects, err := GetProjectsSimplByTaskIDs(s, taskIDs)
if err != nil {
log.Errorf("[Undone Overdue Tasks Reminder] Could not get projects for tasks: %s", err)
return
}
for _, ut := range uts {
var n notifications.Notification = &UndoneTasksOverdueNotification{
User: ut.user,
Tasks: ut.tasks,
User: ut.user,
Tasks: ut.tasks,
Projects: projects,
}
if len(ut.tasks) == 1 {
@ -143,8 +157,9 @@ func RegisterOverdueReminderCron() {
// first entry without knowing the key of it.
for _, t := range ut.tasks {
n = &UndoneTaskOverdueNotification{
User: ut.user,
Task: t,
User: ut.user,
Task: t,
Project: projects[t.ProjectID],
}
}
}