Backport #37365 by @pisarz77 Fix team members missing from assignee list when `team_unit.access_mode` is 0 but the doer is owner. Fix #34871 1. Use `GetTeamUserIDsWithAccessToAnyRepoUnit` for repo assignee list 2. Load assignee list for project issues directly 3. Use `GetTeamUserIDsWithAccessToAnyRepoUnit` for repo reviewer list Signed-off-by: Jakub Pisarczyk <pisarz77@gmail.com> Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: pisarz77 <pisarz77@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_Projects(t *testing.T) {
|
||||
@@ -207,4 +208,18 @@ func Test_Projects(t *testing.T) {
|
||||
assert.Len(t, columnIssues[3], 1)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("LoadIssuesAssigneesForProject", func(t *testing.T) {
|
||||
issuesMap := map[int64]issues_model.IssueList{}
|
||||
issue1 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1})
|
||||
issue6 := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 6})
|
||||
issuesMap[1] = issues_model.IssueList{issue1}
|
||||
issuesMap[2] = issues_model.IssueList{issue6}
|
||||
assignees, err := LoadIssuesAssigneesForProject(t.Context(), issuesMap)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, assignees, 3)
|
||||
require.Equal(t, "user1", assignees[0].Name)
|
||||
require.Equal(t, "user10", assignees[1].Name)
|
||||
require.Equal(t, "user2", assignees[2].Name)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user