fix(namespaces): add list subscriptions (#1254)
Add list subscriptions to namespaces call to enable frontend to show subscription state correctly. Resolves https://github.com/go-vikunja/frontend/issues/75 Reviewed-on: https://kolaente.dev/vikunja/api/pulls/1254 Reviewed-by: konrad <k@knt.li> Co-authored-by: Luca Bernstein <luca@lucabernstein.com> Co-committed-by: Luca Bernstein <luca@lucabernstein.com>
This commit is contained in:
@ -476,12 +476,22 @@ func addListDetails(s *xorm.Session, lists []*List, a web.Auth) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
subscriptions, err := GetSubscriptions(s, SubscriptionEntityList, listIDs, a)
|
||||
if err != nil {
|
||||
log.Errorf("An error occurred while getting list subscriptions for a namespace item: %s", err.Error())
|
||||
subscriptions = make(map[int64]*Subscription)
|
||||
}
|
||||
|
||||
for _, list := range lists {
|
||||
// Don't override the favorite state if it was already set from before (favorite saved filters do this)
|
||||
if list.IsFavorite {
|
||||
continue
|
||||
}
|
||||
list.IsFavorite = favs[list.ID]
|
||||
|
||||
if subscription, exists := subscriptions[list.ID]; exists {
|
||||
list.Subscription = subscription
|
||||
}
|
||||
}
|
||||
|
||||
if len(fileIDs) == 0 {
|
||||
|
Reference in New Issue
Block a user