Fix loading lists and namespaces
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
c6f3086a88
commit
4ef0579a20
|
@ -240,6 +240,9 @@ func (l *List) ReadOne(s *xorm.Session) (err error) {
|
||||||
|
|
||||||
// GetListSimpleByID gets a list with only the basic items, aka no tasks or user objects. Returns an error if the list does not exist.
|
// GetListSimpleByID gets a list with only the basic items, aka no tasks or user objects. Returns an error if the list does not exist.
|
||||||
func GetListSimpleByID(s *xorm.Session, listID int64) (list *List, err error) {
|
func GetListSimpleByID(s *xorm.Session, listID int64) (list *List, err error) {
|
||||||
|
|
||||||
|
list = &List{}
|
||||||
|
|
||||||
if listID < 1 {
|
if listID < 1 {
|
||||||
return nil, ErrListDoesNotExist{ID: listID}
|
return nil, ErrListDoesNotExist{ID: listID}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ func TestListDuplicate(t *testing.T) {
|
||||||
db.LoadAndAssertFixtures(t)
|
db.LoadAndAssertFixtures(t)
|
||||||
files.InitTestFileFixtures(t)
|
files.InitTestFileFixtures(t)
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
|
defer s.Close()
|
||||||
|
|
||||||
u := &user.User{
|
u := &user.User{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
|
@ -46,5 +47,4 @@ func TestListDuplicate(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
// To make this test 100% useful, it would need to assert a lot more stuff, but it is good enough for now.
|
// To make this test 100% useful, it would need to assert a lot more stuff, but it is good enough for now.
|
||||||
// Also, we're lacking utility functions to do all needed assertions.
|
// Also, we're lacking utility functions to do all needed assertions.
|
||||||
_ = s.Close()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,8 @@ func getNamespaceSimpleByID(s *xorm.Session, id int64) (namespace *Namespace, er
|
||||||
return &FavoritesPseudoNamespace, nil
|
return &FavoritesPseudoNamespace, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace = &Namespace{}
|
||||||
|
|
||||||
exists, err := s.Where("id = ?", id).Get(namespace)
|
exists, err := s.Where("id = ?", id).Get(namespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue