Fix returning task attachments created by users
This commit is contained in:
parent
1af4598400
commit
6cea0bb286
@ -553,7 +553,7 @@ func TestLinkSharing(t *testing.T) {
|
||||
rec, err := testHandlerTaskWriteCollection.testReadAllWithLinkShare(nil, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.NotContains(t, rec.Body.String(), `task #2`)
|
||||
assert.NotContains(t, rec.Body.String(), `task #3`)
|
||||
assert.NotContains(t, rec.Body.String(), `task #3"`)
|
||||
assert.NotContains(t, rec.Body.String(), `task #4`)
|
||||
assert.NotContains(t, rec.Body.String(), `task #5`)
|
||||
assert.NotContains(t, rec.Body.String(), `task #6`)
|
||||
|
@ -239,12 +239,9 @@ func getTaskAttachmentsByTaskIDs(s *xorm.Session, taskIDs []int64) (attachments
|
||||
return
|
||||
}
|
||||
|
||||
users := make(map[int64]*user.User)
|
||||
if len(userIDs) > 0 {
|
||||
err = s.In("id", userIDs).Find(&users)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
users, err := getUsersOrLinkSharesFromIDs(s, userIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Obfuscate all user emails
|
||||
|
@ -59,6 +59,12 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
Created: testCreatedTime,
|
||||
Updated: testUpdatedTime,
|
||||
}
|
||||
linkShareUser2 := &user.User{
|
||||
ID: -2,
|
||||
Name: "Link Share",
|
||||
Created: testCreatedTime,
|
||||
Updated: testUpdatedTime,
|
||||
}
|
||||
|
||||
loc := config.GetTimeZone()
|
||||
|
||||
@ -124,6 +130,21 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
CreatedBy: user1,
|
||||
Created: testCreatedTime,
|
||||
},
|
||||
{
|
||||
ID: 3,
|
||||
TaskID: 1,
|
||||
FileID: 1,
|
||||
CreatedByID: -2,
|
||||
CreatedBy: linkShareUser2,
|
||||
Created: testCreatedTime,
|
||||
File: &files.File{
|
||||
ID: 1,
|
||||
Name: "test",
|
||||
Size: 100,
|
||||
Created: time.Unix(1570998791, 0).In(loc),
|
||||
CreatedByID: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
Created: time.Unix(1543626724, 0).In(loc),
|
||||
Updated: time.Unix(1543626724, 0).In(loc),
|
||||
|
Loading…
x
Reference in New Issue
Block a user