diff --git a/pkg/db/fixtures/team_list.yml b/pkg/db/fixtures/team_list.yml index b3e8c23d28f..55699d65bd6 100644 --- a/pkg/db/fixtures/team_list.yml +++ b/pkg/db/fixtures/team_list.yml @@ -45,4 +45,10 @@ list_id: 19 right: 2 updated: 2018-12-02 15:13:12 - created: 2018-12-01 15:13:12 \ No newline at end of file + created: 2018-12-01 15:13:12 +- id: 8 + team_id: 1 + list_id: 21 + right: 0 + updated: 2018-12-02 15:13:12 + created: 2018-12-01 15:13:12 diff --git a/pkg/models/namespace.go b/pkg/models/namespace.go index ff714aa7a29..b87733d1c68 100644 --- a/pkg/models/namespace.go +++ b/pkg/models/namespace.go @@ -332,8 +332,14 @@ func (n *Namespace) ReadAll(s *xorm.Session, a web.Auth, search string, page int Join("LEFT", []string{"team_list", "tl"}, "l.id = tl.list_id"). Join("LEFT", []string{"team_members", "tm"}, "tm.team_id = tl.team_id"). Join("LEFT", []string{"users_list", "ul"}, "ul.list_id = l.id"). - Where("tm.user_id = ?", doer.ID). - Or("ul.user_id = ?", doer.ID). + Where(builder.And( + builder.Eq{"tm.user_id": doer.ID}, + builder.Neq{"l.owner_id": doer.ID}, + )). + Or(builder.And( + builder.Eq{"ul.user_id": doer.ID}, + builder.Neq{"l.owner_id": doer.ID}, + )). GroupBy("l.id") if !n.IsArchived { iListQuery.And("l.is_archived = false") diff --git a/pkg/models/task_collection_test.go b/pkg/models/task_collection_test.go index 7c211122695..f6b0d89461c 100644 --- a/pkg/models/task_collection_test.go +++ b/pkg/models/task_collection_test.go @@ -142,8 +142,11 @@ func TestTaskCollection_ReadAll(t *testing.T) { label4, }, RelatedTasks: map[RelationKind][]*Task{}, - Created: time.Unix(1543626724, 0).In(loc), - Updated: time.Unix(1543626724, 0).In(loc), + Reminders: []time.Time{ + time.Unix(1543626824, 0).In(loc), + }, + Created: time.Unix(1543626724, 0).In(loc), + Updated: time.Unix(1543626724, 0).In(loc), } task3 := &Task{ ID: 3, @@ -883,6 +886,7 @@ func TestTaskCollection_ReadAll(t *testing.T) { }, args: defaultArgs, want: []*Task{ + task2, task27, }, wantErr: false,