fix(tasks): make sure task deleted notification actually has information about the deleted task
This commit is contained in:
@ -298,7 +298,13 @@ func (s *SendTaskDeletedNotification) Handle(msg *message.Message) (err error) {
|
||||
sess := db.NewSession()
|
||||
defer sess.Close()
|
||||
|
||||
subscribers, err := getSubscribersForEntity(sess, SubscriptionEntityTask, event.Task.ID)
|
||||
var subscribers []*Subscription
|
||||
subscribers, err = getSubscribersForEntity(sess, SubscriptionEntityTask, event.Task.ID)
|
||||
// If the task does not exist and no one has explicitely subscribed to it, we won't find any subscriptions for it.
|
||||
// Hence, we need to check for subscriptions to the parent project manually.
|
||||
if err != nil && (IsErrTaskDoesNotExist(err) || IsErrProjectDoesNotExist(err)) {
|
||||
subscribers, err = getSubscribersForEntity(sess, SubscriptionEntityProject, event.Task.ProjectID)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user