Browse Source

repo: cleanup some code

pull/4343/head
Unknwon 8 years ago
parent
commit
674106c7b6
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 5
      cmd/web.go
  2. 4
      models/repo.go
  3. 1
      modules/context/repo.go

5
cmd/web.go

@ -512,6 +512,9 @@ func runWeb(ctx *cli.Context) error {
m.Post("", repo.UpdateCommentContent) m.Post("", repo.UpdateCommentContent)
m.Post("/delete", repo.DeleteComment) m.Post("/delete", repo.DeleteComment)
}) })
m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
m.Get("/milestones", repo.Milestones)
}, ignSignIn, context.RepoAssignment(true)) }, ignSignIn, context.RepoAssignment(true))
m.Group("/:username/:reponame", func() { m.Group("/:username/:reponame", func() {
m.Group("/wiki", func() { m.Group("/wiki", func() {
@ -597,8 +600,6 @@ func runWeb(ctx *cli.Context) error {
m.Get("/releases", repo.MustBeNotBare, repo.Releases) m.Get("/releases", repo.MustBeNotBare, repo.Releases)
m.Get("/pulls", repo.RetrieveLabels, repo.Pulls) m.Get("/pulls", repo.RetrieveLabels, repo.Pulls)
m.Get("/pulls/:index", repo.ViewPull) m.Get("/pulls/:index", repo.ViewPull)
m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
m.Get("/milestones", repo.Milestones)
}, context.RepoRef()) }, context.RepoRef())
m.Group("/branches", func() { m.Group("/branches", func() {

4
models/repo.go

@ -261,11 +261,11 @@ func (repo *Repository) IsPartialPublic() bool {
} }
func (repo *Repository) CanGuestViewWiki() bool { func (repo *Repository) CanGuestViewWiki() bool {
return repo.IsPartialPublic() && repo.EnableWiki && !repo.EnableExternalWiki && repo.AllowPublicWiki return repo.EnableWiki && !repo.EnableExternalWiki && repo.AllowPublicWiki
} }
func (repo *Repository) CanGuestViewIssues() bool { func (repo *Repository) CanGuestViewIssues() bool {
return repo.IsPartialPublic() && repo.EnableIssues && !repo.EnableExternalTracker && repo.AllowPublicIssues return repo.EnableIssues && !repo.EnableExternalTracker && repo.AllowPublicIssues
} }
// MustOwner always returns a valid *User object to avoid conceptually impossible error handling. // MustOwner always returns a valid *User object to avoid conceptually impossible error handling.

1
modules/context/repo.go

@ -142,7 +142,6 @@ func RepoAssignment(pages ...bool) macaron.Handler {
if len(pages) > 1 { if len(pages) > 1 {
isWikiPage = pages[1] isWikiPage = pages[1]
} }
_, _ = isIssuesPage, isWikiPage
ownerName := ctx.Params(":username") ownerName := ctx.Params(":username")
repoName := strings.TrimSuffix(ctx.Params(":reponame"), ".git") repoName := strings.TrimSuffix(ctx.Params(":reponame"), ".git")

Loading…
Cancel
Save