fix(assignees): improve wording for assignee emails

This commit is contained in:
kolaente 2024-01-28 13:11:37 +01:00
parent ce53663a88
commit e03920b84a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 9 additions and 0 deletions

View File

@ -300,6 +300,7 @@ func (s *SendTaskAssignedNotification) Handle(msg *message.Message) (err error)
Doer: event.Doer,
Task: &task,
Assignee: event.Assignee,
Target: subscriber.User,
}
err = notifications.Notify(subscriber.User, n)
if err != nil {

View File

@ -111,10 +111,18 @@ type TaskAssignedNotification struct {
Doer *user.User `json:"doer"`
Task *Task `json:"task"`
Assignee *user.User `json:"assignee"`
Target *user.User `json:"-"`
}
// ToMail returns the mail notification for TaskAssignedNotification
func (n *TaskAssignedNotification) ToMail() *notifications.Mail {
if n.Target.ID == n.Assignee.ID {
return notifications.NewMail().
Subject("You have been assigned to "+n.Task.Title+"("+n.Task.GetFullIdentifier()+")").
Line(n.Doer.GetName()+" has assigned you to "+n.Task.Title+".").
Action("View Task", n.Task.GetFrontendURL())
}
return notifications.NewMail().
Subject(n.Task.Title+"("+n.Task.GetFullIdentifier()+")"+" has been assigned to "+n.Assignee.GetName()).
Line(n.Doer.GetName()+" has assigned this task to "+n.Assignee.GetName()+".").