Fix error when searching for a namespace with subscribers
This commit is contained in:
parent
67f863120e
commit
88b9ea6a96
1 changed files with 5 additions and 1 deletions
|
@ -291,6 +291,11 @@ func getNamespaceOwnerIDs(namespaces map[int64]*NamespaceWithLists) (namespaceID
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNamespaceSubscriptions(s *xorm.Session, namespaceIDs []int64, userID int64) (map[int64]*Subscription, error) {
|
func getNamespaceSubscriptions(s *xorm.Session, namespaceIDs []int64, userID int64) (map[int64]*Subscription, error) {
|
||||||
|
subscriptionsMap := make(map[int64]*Subscription)
|
||||||
|
if len(namespaceIDs) == 0 {
|
||||||
|
return subscriptionsMap, nil
|
||||||
|
}
|
||||||
|
|
||||||
subscriptions := []*Subscription{}
|
subscriptions := []*Subscription{}
|
||||||
err := s.
|
err := s.
|
||||||
Where("entity_type = ? AND user_id = ?", SubscriptionEntityNamespace, userID).
|
Where("entity_type = ? AND user_id = ?", SubscriptionEntityNamespace, userID).
|
||||||
|
@ -299,7 +304,6 @@ func getNamespaceSubscriptions(s *xorm.Session, namespaceIDs []int64, userID int
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
subscriptionsMap := make(map[int64]*Subscription)
|
|
||||||
for _, sub := range subscriptions {
|
for _, sub := range subscriptions {
|
||||||
sub.Entity = sub.EntityType.String()
|
sub.Entity = sub.EntityType.String()
|
||||||
subscriptionsMap[sub.EntityID] = sub
|
subscriptionsMap[sub.EntityID] = sub
|
||||||
|
|
Loading…
Reference in a new issue