From 33444a33082df04b05bc9d6894db47069bd7b002 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Mon, 8 Apr 2024 15:16:40 +0200 Subject: [PATCH] Fix: missing value for In() condition --- models/issues/issue_list.go | 2 +- models/issues/issue_list_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index 218891ad3..da55ff1b0 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -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 } diff --git a/models/issues/issue_list_test.go b/models/issues/issue_list_test.go index 9069e1012..10ba38a64 100644 --- a/models/issues/issue_list_test.go +++ b/models/issues/issue_list_test.go @@ -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) + } }