Use namespace.ReadAll to get all namespaces

This commit is contained in:
kolaente 2021-08-27 18:08:11 +02:00
parent 011f0bc9b0
commit c74cdcbdc9
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 12 additions and 4 deletions

View File

@ -67,7 +67,6 @@ func ExportUserData(u *user.User) (err error) {
if err != nil {
return err
}
// Subscription Status
// Background files
// Pack it in a zip file and save it
@ -78,13 +77,22 @@ func ExportUserData(u *user.User) (err error) {
}
func exportListsAndTasks(s *xorm.Session, u *user.User, wr *zip.Writer) (err error) {
namespaces := make(map[int64]*NamespaceWithLists)
_, err = getNamespacesWithLists(s, &namespaces, "", true, 0, -1, u.ID)
namspaces, _, _, err := (&Namespace{}).ReadAll(s, u, "", -1, 0)
if err != nil {
return err
}
namespaceIDs, _ := getNamespaceOwnerIDs(namespaces)
namespaceIDs := []int64{}
namespaces := []*NamespaceWithLists{}
for _, n := range namspaces.([]*NamespaceWithLists) {
if n.ID < 1 {
// Don't include filters
continue
}
namespaceIDs = append(namespaceIDs, n.ID)
namespaces = append(namespaces, n)
}
if len(namespaceIDs) == 0 {
return nil