Add reminders for overdue tasks (#832)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/832 Co-authored-by: konrad <konrad@kola-entertainments.de> Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
@ -20,6 +20,7 @@ import (
|
||||
"bufio"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.vikunja.io/api/pkg/config"
|
||||
"code.vikunja.io/api/pkg/notifications"
|
||||
@ -184,3 +185,29 @@ func (n *TeamMemberAddedNotification) ToDB() interface{} {
|
||||
func (n *TeamMemberAddedNotification) Name() string {
|
||||
return "team.member.added"
|
||||
}
|
||||
|
||||
// UndoneTaskOverdueNotification represents a UndoneTaskOverdueNotification notification
|
||||
type UndoneTaskOverdueNotification struct {
|
||||
User *user.User
|
||||
Task *Task
|
||||
}
|
||||
|
||||
// ToMail returns the mail notification for UndoneTaskOverdueNotification
|
||||
func (n *UndoneTaskOverdueNotification) ToMail() *notifications.Mail {
|
||||
return notifications.NewMail().
|
||||
Subject(`Task "`+n.Task.Title+`" is overdue`).
|
||||
Greeting("Hi "+n.User.GetName()+",").
|
||||
Line(`This is a friendly reminder of the task "`+n.Task.Title+`" which is overdue since `+time.Until(n.Task.DueDate).String()+` and not yet done.`).
|
||||
Action("Open Task", config.ServiceFrontendurl.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
|
||||
Line("Have a nice day!")
|
||||
}
|
||||
|
||||
// ToDB returns the UndoneTaskOverdueNotification notification in a format which can be saved in the db
|
||||
func (n *UndoneTaskOverdueNotification) ToDB() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns the name of the notification
|
||||
func (n *UndoneTaskOverdueNotification) Name() string {
|
||||
return "task.undone.overdue"
|
||||
}
|
||||
|
Reference in New Issue
Block a user