From c2b6119434e6e806785d2c259c3ca3d25496ec75 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 16 Oct 2021 16:38:59 +0200 Subject: [PATCH] fix: make sure the full task is available in notifications --- pkg/models/listeners.go | 7 ++++++- pkg/models/notifications.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/models/listeners.go b/pkg/models/listeners.go index b16b52f5..0e0eb13c 100644 --- a/pkg/models/listeners.go +++ b/pkg/models/listeners.go @@ -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) + task, err := GetTaskByIDSimple(sess, event.Task.ID) + if err != nil { + return err + } + for _, subscriber := range subscribers { if subscriber.UserID == event.Doer.ID { continue @@ -254,7 +259,7 @@ func (s *SendTaskAssignedNotification) Handle(msg *message.Message) (err error) n := &TaskAssignedNotification{ Doer: event.Doer, - Task: event.Task, + Task: &task, Assignee: event.Assignee, } err = notifications.Notify(subscriber.User, n) diff --git a/pkg/models/notifications.go b/pkg/models/notifications.go index 71a30d3f..02688b8b 100644 --- a/pkg/models/notifications.go +++ b/pkg/models/notifications.go @@ -112,7 +112,7 @@ type TaskAssignedNotification struct { func (n *TaskAssignedNotification) ToMail() *notifications.Mail { 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()). + Line(n.Doer.GetName()+" has assigned this task to "+n.Assignee.GetName()+"."). Action("View Task", n.Task.GetFrontendURL()) }