Fix the shared lists pseudo namespace containing owned lists
This commit is contained in:
parent
6bdc1fdb0d
commit
2d283b78c2
3 changed files with 21 additions and 5 deletions
|
@ -46,3 +46,9 @@
|
||||||
right: 2
|
right: 2
|
||||||
updated: 2018-12-02 15:13:12
|
updated: 2018-12-02 15:13:12
|
||||||
created: 2018-12-01 15:13:12
|
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
|
||||||
|
|
|
@ -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_list", "tl"}, "l.id = tl.list_id").
|
||||||
Join("LEFT", []string{"team_members", "tm"}, "tm.team_id = tl.team_id").
|
Join("LEFT", []string{"team_members", "tm"}, "tm.team_id = tl.team_id").
|
||||||
Join("LEFT", []string{"users_list", "ul"}, "ul.list_id = l.id").
|
Join("LEFT", []string{"users_list", "ul"}, "ul.list_id = l.id").
|
||||||
Where("tm.user_id = ?", doer.ID).
|
Where(builder.And(
|
||||||
Or("ul.user_id = ?", doer.ID).
|
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")
|
GroupBy("l.id")
|
||||||
if !n.IsArchived {
|
if !n.IsArchived {
|
||||||
iListQuery.And("l.is_archived = false")
|
iListQuery.And("l.is_archived = false")
|
||||||
|
|
|
@ -142,8 +142,11 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||||
label4,
|
label4,
|
||||||
},
|
},
|
||||||
RelatedTasks: map[RelationKind][]*Task{},
|
RelatedTasks: map[RelationKind][]*Task{},
|
||||||
Created: time.Unix(1543626724, 0).In(loc),
|
Reminders: []time.Time{
|
||||||
Updated: time.Unix(1543626724, 0).In(loc),
|
time.Unix(1543626824, 0).In(loc),
|
||||||
|
},
|
||||||
|
Created: time.Unix(1543626724, 0).In(loc),
|
||||||
|
Updated: time.Unix(1543626724, 0).In(loc),
|
||||||
}
|
}
|
||||||
task3 := &Task{
|
task3 := &Task{
|
||||||
ID: 3,
|
ID: 3,
|
||||||
|
@ -883,6 +886,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||||
},
|
},
|
||||||
args: defaultArgs,
|
args: defaultArgs,
|
||||||
want: []*Task{
|
want: []*Task{
|
||||||
|
task2,
|
||||||
task27,
|
task27,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
|
|
Loading…
Reference in a new issue