summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-27 21:15:53 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-27 21:15:53 -0400
commit5344a0300383c4921e4a5810dff58c7686412f0c (patch)
treeb1010551e0c1060f25eb69bdc7f5d66f5f2c844b
parent8b700e825b7c39285cbc3e87a48b9bcb77864beb (diff)
downloadgitea-5344a0300383c4921e4a5810dff58c7686412f0c.tar.gz
gitea-5344a0300383c4921e4a5810dff58c7686412f0c.zip
Bug fix
-rw-r--r--modules/middleware/repo.go4
-rw-r--r--routers/repo/issue.go3
-rw-r--r--routers/repo/repo.go4
-rw-r--r--templates/repo/toolbar.tmpl2
4 files changed, 10 insertions, 3 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index bc90c05cc7..cb4a8632a2 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -56,7 +56,9 @@ func RepoAssignment(redirect bool) martini.Handler {
// get repository
repo, err := models.GetRepositoryByName(user.Id, params["reponame"])
if err != nil {
- if redirect {
+ if err == models.ErrRepoNotExist {
+ ctx.Handle(404, "RepoAssignment", err)
+ } else if redirect {
ctx.Redirect("/")
return
}
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index ba0669a0ad..77e35bbae6 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -6,6 +6,7 @@ package repo
import (
"fmt"
+ "net/url"
"github.com/codegangsta/martini"
@@ -35,7 +36,9 @@ func Issues(ctx *middleware.Context) {
var posterId int64 = 0
if ctx.Query("type") == "created_by" {
if !ctx.IsSigned {
+ ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login/", 302)
+ return
}
posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by"
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 3b57cb39f6..e7107ad1cd 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -85,9 +85,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
ctx.Data["Branches"] = brs
var commitId string
- if !models.IsBranchExist(userName, repoName, branchName) {
+ isViewBranch := models.IsBranchExist(userName, repoName, branchName)
+ if !isViewBranch {
commitId = branchName
}
+ ctx.Data["IsViewBranch"] = isViewBranch
repoFile, err := models.GetTargetFile(userName, repoName,
branchName, commitId, treename)
diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl
index e3390c77ca..ac516c37dd 100644
--- a/templates/repo/toolbar.tmpl
+++ b/templates/repo/toolbar.tmpl
@@ -5,7 +5,7 @@
<ul class="nav navbar-nav">
<li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li>
{{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 .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>