1
0

fix(subscription): always return task subscription when subscribed to task and project

(cherry picked from commit 115d1c3618811560b4f2c87d764da196bafc1c06)
This commit is contained in:
kolaente 2024-09-03 22:37:53 +02:00
parent 1c64b75f86
commit c8f7a57566
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

View File

@ -242,6 +242,15 @@ func GetSubscriptions(s *xorm.Session, entityType SubscriptionEntityType, entity
return nil, err
}
for _, sub := range subs {
// The subscriptions might also contain the immediate parent subscription, if that exists.
// This loop makes sure to only return the task subscription if it exists. The fallback
// happens in the next if after the loop.
if sub.EntityID == entityID && sub.EntityType == SubscriptionEntityTask {
return []*Subscription{sub}, nil
}
}
if len(subs) > 0 {
return subs, nil
}