1
0

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:
kolaente
2024-09-04 19:54:22 +02:00
parent 7646c7f0c9
commit 8b8ec19bb3
7 changed files with 330 additions and 265 deletions

View File

@ -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
}