From 6e0bc0d3be879bbd25596cc3569bbf0d275c240b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 2 Sep 2024 23:48:53 -0700 Subject: [PATCH] Fix test --- routers/web/repo/issue.go | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 1217a6e6591..859bc27c2b1 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -2075,25 +2075,27 @@ func ViewIssue(ctx *context.Context) { return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee) } - forkedRepos, err := repo_model.FindUserOrgForks(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID) - if err != nil { - ctx.ServerError("FindUserOrgForks", err) - return - } + if ctx.IsSigned { + forkedRepos, err := repo_model.FindUserOrgForks(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID) + if err != nil { + ctx.ServerError("FindUserOrgForks", err) + return + } - ctx.Data["AllowedRepos"] = append(forkedRepos, ctx.Repo.Repository) + ctx.Data["AllowedRepos"] = append(forkedRepos, ctx.Repo.Repository) - devLinks, err := issue_service.FindIssueDevLinksByIssue(ctx, issue) - if err != nil { - ctx.ServerError("FindIssueDevLinksByIssue", err) - return - } - ctx.Data["DevLinks"] = devLinks - for _, link := range devLinks { - if link.LinkType == issues_model.IssueDevLinkTypePullRequest { - if !(link.PullRequest.Issue.IsClosed && !link.PullRequest.HasMerged) { - ctx.Data["MaybeFixed"] = link.PullRequest - break + devLinks, err := issue_service.FindIssueDevLinksByIssue(ctx, issue) + if err != nil { + ctx.ServerError("FindIssueDevLinksByIssue", err) + return + } + ctx.Data["DevLinks"] = devLinks + for _, link := range devLinks { + if link.LinkType == issues_model.IssueDevLinkTypePullRequest { + if !(link.PullRequest.Issue.IsClosed && !link.PullRequest.HasMerged) { + ctx.Data["MaybeFixed"] = link.PullRequest + break + } } } }