Skip to content

Commit ea566cc

Browse files
committed
Don't load projects if permissions don't allow it
1 parent 911509b commit ea566cc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

routers/web/repo/issue.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,19 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
328328
return 0
329329
}
330330

331-
projects, _, err := models.GetProjects(models.ProjectSearchOptions{
332-
RepoID: repo.ID,
333-
Type: models.ProjectTypeRepository,
334-
IsClosed: util.OptionalBoolOf(isShowClosed),
335-
})
336-
if err != nil {
337-
ctx.ServerError("GetProjects", err)
338-
return
331+
if ctx.Repo.CanWriteIssuesOrPulls(ctx.Params(":type") == "pulls") {
332+
projects, _, err := models.GetProjects(models.ProjectSearchOptions{
333+
RepoID: repo.ID,
334+
Type: models.ProjectTypeRepository,
335+
IsClosed: util.OptionalBoolOf(isShowClosed),
336+
})
337+
if err != nil {
338+
ctx.ServerError("GetProjects", err)
339+
return
340+
}
341+
ctx.Data["Projects"] = projects
339342
}
340343

341-
ctx.Data["Projects"] = projects
342344
ctx.Data["IssueStats"] = issueStats
343345
ctx.Data["SelLabelIDs"] = labelIDs
344346
ctx.Data["SelectLabels"] = selectLabels

0 commit comments

Comments
 (0)