Fix trying to send reminders to people who have disabled email reminders
This commit is contained in:
parent
2c780a80f8
commit
d1823448d4
|
@ -36,7 +36,7 @@ func (n *ReminderDueNotification) ToMail() *notifications.Mail {
|
|||
Subject(`Reminder for "`+n.Task.Title+`"`).
|
||||
Greeting("Hi "+n.User.GetName()+",").
|
||||
Line(`This is a friendly reminder of the task "`+n.Task.Title+`".`).
|
||||
Action("Open Task", config.ServiceFrontendurl.GetString()+"/tasks/"+strconv.FormatInt(n.Task.ID, 10)).
|
||||
Action("Open Task", config.ServiceFrontendurl.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
|
||||
Line("Have a nice day!")
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,6 @@ func getTaskUsersForTasks(s *xorm.Session, taskIDs []int64) (taskUsers []*taskUs
|
|||
return
|
||||
}
|
||||
|
||||
assignees, err := getRawTaskAssigneesForTasks(s, taskIDs)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
taskMap := make(map[int64]*Task, len(taskIDs))
|
||||
err = s.In("id", taskIDs).Find(&taskMap)
|
||||
if err != nil {
|
||||
|
@ -73,12 +68,22 @@ func getTaskUsersForTasks(s *xorm.Session, taskIDs []int64) (taskUsers []*taskUs
|
|||
}
|
||||
|
||||
for _, taskID := range taskIDs {
|
||||
u, exists := creators[taskMap[taskID].CreatedByID]
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
|
||||
taskUsers = append(taskUsers, &taskUser{
|
||||
Task: taskMap[taskID],
|
||||
User: creators[taskMap[taskID].CreatedByID],
|
||||
User: u,
|
||||
})
|
||||
}
|
||||
|
||||
assignees, err := getRawTaskAssigneesForTasks(s, taskIDs)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, assignee := range assignees {
|
||||
if !assignee.EmailRemindersEnabled { // Can't filter that through a query directly since we're using another function
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue