Exlicitly get the pseudonamespace with all shared lists #32

Merged
konrad merged 2 commits from feature/get-namespace-with-shared-lists into master 2018-12-04 10:16:42 +00:00
Showing only changes of commit 0b2e2adb8d - Show all commits

View File

@ -37,6 +37,7 @@ type Namespace struct {
web.Rights `xorm:"-" json:"-"` web.Rights `xorm:"-" json:"-"`
} }
// PseudoNamespace is a pseudo namespace used to hold shared lists
var PseudoNamespace = Namespace{ var PseudoNamespace = Namespace{
ID: -1, ID: -1,
Name: "Shared Lists", Name: "Shared Lists",
@ -63,14 +64,14 @@ func GetNamespaceByID(id int64) (namespace Namespace, err error) {
return namespace, err return namespace, err
} }
exists, err := x.Get(&namespace) exists, err := x.Get(&namespace)
if err != nil { if err != nil {
return namespace, err return namespace, err
} }
if !exists { if !exists {
return namespace, ErrNamespaceDoesNotExist{ID: id} return namespace, ErrNamespaceDoesNotExist{ID: id}
} }
// Get the namespace Owner // Get the namespace Owner
namespace.Owner, err = GetUserByID(namespace.OwnerID) namespace.Owner, err = GetUserByID(namespace.OwnerID)