From fd836ff68b6ec60c410daa9df54d36ed9ecebc78 Mon Sep 17 00:00:00 2001 From: caicandong <50507092+CaiCandong@users.noreply.github.com> Date: Sat, 29 Jul 2023 23:35:53 +0800 Subject: [PATCH] Fix unable to display individual-level project (#26198) As title Before: ![image](https://github.com/go-gitea/gitea/assets/50507092/94afc3bf-5597-4151-a59b-5632840ffa21) After: ![image](https://github.com/go-gitea/gitea/assets/50507092/df81aa0b-98a6-477d-a270-2e45b3dca0fc) fix #26189 --- routers/web/repo/issue.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index f243507c3..f901ebaf6 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -518,6 +518,12 @@ func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *repo_model.R } func retrieveProjects(ctx *context.Context, repo *repo_model.Repository) { + // Distinguish whether the owner of the repository + // is an individual or an organization + repoOwnerType := project_model.TypeIndividual + if repo.Owner.IsOrganization() { + repoOwnerType = project_model.TypeOrganization + } var err error projects, _, err := project_model.FindProjects(ctx, project_model.SearchOptions{ RepoID: repo.ID, @@ -533,7 +539,7 @@ func retrieveProjects(ctx *context.Context, repo *repo_model.Repository) { OwnerID: repo.OwnerID, Page: -1, IsClosed: util.OptionalBoolFalse, - Type: project_model.TypeOrganization, + Type: repoOwnerType, }) if err != nil { ctx.ServerError("GetProjects", err) @@ -556,7 +562,7 @@ func retrieveProjects(ctx *context.Context, repo *repo_model.Repository) { OwnerID: repo.OwnerID, Page: -1, IsClosed: util.OptionalBoolTrue, - Type: project_model.TypeOrganization, + Type: repoOwnerType, }) if err != nil { ctx.ServerError("GetProjects", err)