Fix: missing value for In() condition

This commit is contained in:
oliverpool 2024-04-08 15:16:40 +02:00
parent c9854bee98
commit 33444a3308
2 changed files with 6 additions and 1 deletions

View file

@ -616,7 +616,7 @@ func (issues IssueList) LoadIsRead(ctx context.Context, userID int64) error {
issueIDs := issues.getIssueIDs()
issueUsers := make([]*IssueUser, 0, len(issueIDs))
if err := db.GetEngine(ctx).Where("uid =?", userID).
In("issue_id").
In("issue_id", issueIDs).
Find(&issueUsers); err != nil {
return err
}

View file

@ -72,4 +72,9 @@ func TestIssueList_LoadAttributes(t *testing.T) {
assert.Nil(t, issue.Project)
}
}
assert.NoError(t, issueList.LoadIsRead(db.DefaultContext, 1))
for _, issue := range issueList {
assert.Equal(t, issue.ID == 1, issue.IsRead, "unexpected is_read value for issue[%d]", issue.ID)
}
}