From 8196430f47842fba4f227b105cd96d4b981d077d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 24 Mar 2017 16:25:40 -0400 Subject: repo: allow private repository to have public wiki or issues Relates to #649 and #2157 --- cmd/web.go | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'cmd') diff --git a/cmd/web.go b/cmd/web.go index 061a1c58..7c0d210e 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -493,18 +493,15 @@ func runWeb(ctx *cli.Context) error { m.Get("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), repo.Action) m.Group("/:username/:reponame", func() { + m.Get("/issues", repo.RetrieveLabels, repo.Issues) + m.Get("/issues/:index", repo.ViewIssue) + // FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest. // So they can apply their own enable/disable logic on routers. m.Group("/issues", func() { m.Combo("/new", repo.MustEnableIssues).Get(context.RepoRef(), repo.NewIssue). Post(bindIgnErr(form.NewIssue{}), repo.NewIssuePost) - m.Group("/:index", func() { - m.Post("/label", repo.UpdateIssueLabel) - m.Post("/milestone", repo.UpdateIssueMilestone) - m.Post("/assignee", repo.UpdateIssueAssignee) - }, reqRepoWriter) - m.Group("/:index", func() { m.Post("/title", repo.UpdateIssueTitle) m.Post("/content", repo.UpdateIssueContent) @@ -515,6 +512,24 @@ func runWeb(ctx *cli.Context) error { m.Post("", repo.UpdateCommentContent) m.Post("/delete", repo.DeleteComment) }) + }, ignSignIn, context.RepoAssignment(true)) + m.Group("/:username/:reponame", func() { + m.Group("/wiki", func() { + m.Get("/?:page", repo.Wiki) + m.Get("/_pages", repo.WikiPages) + }, repo.MustEnableWiki, context.RepoRef()) + }, ignSignIn, context.RepoAssignment(false, true)) + + m.Group("/:username/:reponame", func() { + // FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest. + // So they can apply their own enable/disable logic on routers. + m.Group("/issues", func() { + m.Group("/:index", func() { + m.Post("/label", repo.UpdateIssueLabel) + m.Post("/milestone", repo.UpdateIssueMilestone) + m.Post("/assignee", repo.UpdateIssueAssignee) + }, reqRepoWriter) + }) m.Group("/labels", func() { m.Post("/new", bindIgnErr(form.CreateLabel{}), repo.NewLabel) m.Post("/edit", bindIgnErr(form.CreateLabel{}), repo.UpdateLabel) @@ -580,8 +595,8 @@ func runWeb(ctx *cli.Context) error { m.Group("/:username/:reponame", func() { m.Group("", func() { m.Get("/releases", repo.MustBeNotBare, repo.Releases) - m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) - m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) + m.Get("/pulls", repo.RetrieveLabels, repo.Pulls) + m.Get("/pulls/:index", repo.ViewPull) m.Get("/labels/", repo.RetrieveLabels, repo.Labels) m.Get("/milestones", repo.Milestones) }, context.RepoRef()) @@ -595,9 +610,6 @@ func runWeb(ctx *cli.Context) error { }) m.Group("/wiki", func() { - m.Get("/?:page", repo.Wiki) - m.Get("/_pages", repo.WikiPages) - m.Group("", func() { m.Combo("/_new").Get(repo.NewWiki). Post(bindIgnErr(form.NewWiki{}), repo.NewWikiPost) -- cgit v1.2.3