Browse Source

Bug fix

pull/71/head
Unknown 11 years ago
parent
commit
5344a03003
  1. 4
      modules/middleware/repo.go
  2. 3
      routers/repo/issue.go
  3. 4
      routers/repo/repo.go
  4. 2
      templates/repo/toolbar.tmpl

4
modules/middleware/repo.go

@ -56,7 +56,9 @@ func RepoAssignment(redirect bool) martini.Handler {
// get repository // get repository
repo, err := models.GetRepositoryByName(user.Id, params["reponame"]) repo, err := models.GetRepositoryByName(user.Id, params["reponame"])
if err != nil { if err != nil {
if redirect { if err == models.ErrRepoNotExist {
ctx.Handle(404, "RepoAssignment", err)
} else if redirect {
ctx.Redirect("/") ctx.Redirect("/")
return return
} }

3
routers/repo/issue.go

@ -6,6 +6,7 @@ package repo
import ( import (
"fmt" "fmt"
"net/url"
"github.com/codegangsta/martini" "github.com/codegangsta/martini"
@ -35,7 +36,9 @@ func Issues(ctx *middleware.Context) {
var posterId int64 = 0 var posterId int64 = 0
if ctx.Query("type") == "created_by" { if ctx.Query("type") == "created_by" {
if !ctx.IsSigned { if !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login/", 302) ctx.Redirect("/user/login/", 302)
return
} }
posterId = ctx.User.Id posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by" ctx.Data["ViewType"] = "created_by"

4
routers/repo/repo.go

@ -85,9 +85,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
ctx.Data["Branches"] = brs ctx.Data["Branches"] = brs
var commitId string var commitId string
if !models.IsBranchExist(userName, repoName, branchName) { isViewBranch := models.IsBranchExist(userName, repoName, branchName)
if !isViewBranch {
commitId = branchName commitId = branchName
} }
ctx.Data["IsViewBranch"] = isViewBranch
repoFile, err := models.GetTargetFile(userName, repoName, repoFile, err := models.GetTargetFile(userName, repoName,
branchName, commitId, treename) branchName, commitId, treename)

2
templates/repo/toolbar.tmpl

@ -5,7 +5,7 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li> <li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li>
{{if not .IsBareRepo}} {{if not .IsBareRepo}}
<li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="/{{.RepositoryLink}}/commits/{{.Branchname}}">Commits</a></li> {{if .IsViewBranch}}<li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="/{{.RepositoryLink}}/commits/{{.Branchname}}">Commits</a></li>{{end}}
<!-- <li class="{{if .IsRepoToolbarBranches}}active{{end}}"><a href="/{{.RepositoryLink}}/branches">Branches</a></li> --> <!-- <li class="{{if .IsRepoToolbarBranches}}active{{end}}"><a href="/{{.RepositoryLink}}/branches">Branches</a></li> -->
<!-- <li class="{{if .IsRepoToolbarPulls}}active{{end}}"><a href="/{{.RepositoryLink}}/pulls">Pull Requests</a></li> --> <!-- <li class="{{if .IsRepoToolbarPulls}}active{{end}}"><a href="/{{.RepositoryLink}}/pulls">Pull Requests</a></li> -->
<li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="/{{.RepositoryLink}}/issues">Issues <!--<span class="badge">42</span>--></a></li> <li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="/{{.RepositoryLink}}/issues">Issues <!--<span class="badge">42</span>--></a></li>

Loading…
Cancel
Save