From 224cebfd1040981b2b82d2f32a69c9d6f94097ce Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 6 Oct 2018 22:26:17 +0200 Subject: [PATCH] Fixed tests failing --- models/list_rights.go | 2 +- models/namespace_rights.go | 2 +- models/namespace_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/list_rights.go b/models/list_rights.go index 9a70e2412..ba13308cb 100644 --- a/models/list_rights.go +++ b/models/list_rights.go @@ -78,7 +78,7 @@ func (l *List) checkListTeamRight(user *User, r TeamRight) bool { Join("LEFT", []string{"team_members", "tm"}, "tm.team_id = tn.team_id"). Join("LEFT", []string{"team_list", "tl"}, "l.id = tl.list_id"). Join("LEFT", []string{"team_members", "tm2"}, "tm2.team_id = tl.team_id"). - Where("((tm.user_id = ? AND tn.right = ?) OR (tm2.user_id = ? AND tl.rights = ?)) AND l.id = ?", + Where("((tm.user_id = ? AND tn.right = ?) OR (tm2.user_id = ? AND tl.right = ?)) AND l.id = ?", user.ID, r, user.ID, r, l.ID). Exist(&List{}) if err != nil { diff --git a/models/namespace_rights.go b/models/namespace_rights.go index bf1160102..5840c38bb 100644 --- a/models/namespace_rights.go +++ b/models/namespace_rights.go @@ -80,7 +80,7 @@ func (n *Namespace) checkTeamRights(user *User, r TeamRight) bool { Join("LEFT", "team_namespaces", "namespaces.id = team_namespaces.namespace_id"). Join("LEFT", "team_members", "team_members.team_id = team_namespaces.team_id"). Where("namespaces.id = ? "+ - "AND ((team_members.user_id = ? AND team_namespaces.right = ?) "+ + "AND (team_members.user_id = ? AND team_namespaces.right = ?) "+ "OR namespaces.owner_id = ? ", n.ID, user.ID, r, user.ID). Get(&Namespace{}) if err != nil { diff --git a/models/namespace_test.go b/models/namespace_test.go index c324e4beb..140f32397 100644 --- a/models/namespace_test.go +++ b/models/namespace_test.go @@ -52,7 +52,7 @@ func TestNamespace_Create(t *testing.T) { assert.NoError(t, err) // Try updating one with a nonexistant owner - dummynamespace.OwnerID = 94829838572 + dummynamespace.Owner.ID = 94829838572 err = dummynamespace.Update() assert.Error(t, err) assert.True(t, IsErrUserDoesNotExist(err))