fix: make sure the full task is available in notifications

This commit is contained in:
kolaente 2021-10-16 16:38:59 +02:00
parent f46c1c5d13
commit c2b6119434
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 7 additions and 2 deletions

View file

@ -247,6 +247,11 @@ func (s *SendTaskAssignedNotification) Handle(msg *message.Message) (err error)
log.Debugf("Sending task assigned notifications to %d subscribers for task %d", len(subscribers), event.Task.ID) log.Debugf("Sending task assigned notifications to %d subscribers for task %d", len(subscribers), event.Task.ID)
task, err := GetTaskByIDSimple(sess, event.Task.ID)
if err != nil {
return err
}
for _, subscriber := range subscribers { for _, subscriber := range subscribers {
if subscriber.UserID == event.Doer.ID { if subscriber.UserID == event.Doer.ID {
continue continue
@ -254,7 +259,7 @@ func (s *SendTaskAssignedNotification) Handle(msg *message.Message) (err error)
n := &TaskAssignedNotification{ n := &TaskAssignedNotification{
Doer: event.Doer, Doer: event.Doer,
Task: event.Task, Task: &task,
Assignee: event.Assignee, Assignee: event.Assignee,
} }
err = notifications.Notify(subscriber.User, n) err = notifications.Notify(subscriber.User, n)

View file

@ -112,7 +112,7 @@ type TaskAssignedNotification struct {
func (n *TaskAssignedNotification) ToMail() *notifications.Mail { func (n *TaskAssignedNotification) ToMail() *notifications.Mail {
return notifications.NewMail(). return notifications.NewMail().
Subject(n.Task.Title+"("+n.Task.GetFullIdentifier()+")"+" has been assigned to "+n.Assignee.GetName()). 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()). Line(n.Doer.GetName()+" has assigned this task to "+n.Assignee.GetName()+".").
Action("View Task", n.Task.GetFrontendURL()) Action("View Task", n.Task.GetFrontendURL())
} }