1
0

Send a notification to the user when they are added to the list

This commit is contained in:
kolaente
2021-02-17 20:48:06 +01:00
parent 0bd27ddeb7
commit c873c1ec32
5 changed files with 61 additions and 6 deletions

View File

@ -59,7 +59,7 @@ type TaskCommentNotification struct {
func (n *TaskCommentNotification) ToMail() *notifications.Mail {
mail := notifications.NewMail().
From(n.Doer.GetName() + " via Vikunja <" + config.MailerFromEmail.GetString() + ">").
From(n.Doer.GetNameAndFromEmail()).
Subject("Re: " + n.Task.Title)
lines := bufio.NewScanner(strings.NewReader(n.Comment.Comment))
@ -132,3 +132,25 @@ func (n *ListCreatedNotification) ToMail() *notifications.Mail {
func (n *ListCreatedNotification) ToDB() interface{} {
return nil
}
// TeamMemberAddedNotification represents a TeamMemberAddedNotification notification
type TeamMemberAddedNotification struct {
Member *user.User
Doer *user.User
Team *Team
}
// ToMail returns the mail notification for TeamMemberAddedNotification
func (n *TeamMemberAddedNotification) ToMail() *notifications.Mail {
return notifications.NewMail().
Subject(n.Doer.GetName()+" added you to the "+n.Team.Name+" team in Vikunja").
From(n.Doer.GetNameAndFromEmail()).
Greeting("Hi "+n.Member.GetName()+",").
Line(n.Doer.GetName()+" has just added you to the "+n.Team.Name+" team in Vikunja.").
Action("View Team", config.ServiceFrontendurl.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit")
}
// ToDB returns the TeamMemberAddedNotification notification in a format which can be saved in the db
func (n *TeamMemberAddedNotification) ToDB() interface{} {
return nil
}