fix(subscriptions): cleanup and simplify fetching subscribers for tasks and projects logic
Vikunja now uses one recursive CTE and a few optimizations to fetch all subscribers for a task or project. This makes the relevant code easier to maintain and more performant. (cherry picked from commit 4ff8815fe1bfe72e02c10f6a6877c93a630f36a4)
This commit is contained in:
@ -1573,10 +1573,11 @@ func (t *Task) ReadOne(s *xorm.Session, a web.Auth) (err error) {
|
||||
|
||||
*t = *taskMap[t.ID]
|
||||
|
||||
t.Subscription, err = GetSubscription(s, SubscriptionEntityTask, t.ID, a)
|
||||
subs, err := GetSubscriptionForUser(s, SubscriptionEntityTask, t.ID, a)
|
||||
if err != nil && IsErrProjectDoesNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
t.Subscription = &subs.Subscription
|
||||
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user