Fix loading lists and namespaces
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2020-12-23 15:09:08 +01:00
parent c6f3086a88
commit 4ef0579a20
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 6 additions and 1 deletions

View File

@ -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.
func GetListSimpleByID(s *xorm.Session, listID int64) (list *List, err error) {
list = &List{}
if listID < 1 {
return nil, ErrListDoesNotExist{ID: listID}
}

View File

@ -30,6 +30,7 @@ func TestListDuplicate(t *testing.T) {
db.LoadAndAssertFixtures(t)
files.InitTestFileFixtures(t)
s := db.NewSession()
defer s.Close()
u := &user.User{
ID: 1,
@ -46,5 +47,4 @@ func TestListDuplicate(t *testing.T) {
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.
// Also, we're lacking utility functions to do all needed assertions.
_ = s.Close()
}

View File

@ -109,6 +109,8 @@ func getNamespaceSimpleByID(s *xorm.Session, id int64) (namespace *Namespace, er
return &FavoritesPseudoNamespace, nil
}
namespace = &Namespace{}
exists, err := s.Where("id = ?", id).Get(namespace)
if err != nil {
return