]> source.dussan.org Git - gitea.git/commitdiff
Bug fix
authorUnknown <joe2010xtmf@163.com>
Fri, 28 Mar 2014 01:15:53 +0000 (21:15 -0400)
committerUnknown <joe2010xtmf@163.com>
Fri, 28 Mar 2014 01:15:53 +0000 (21:15 -0400)
modules/middleware/repo.go
routers/repo/issue.go
routers/repo/repo.go
templates/repo/toolbar.tmpl

index bc90c05cc784aca9706e4c2042d1ddfbf7dd93ef..cb4a8632a279a4f493194cb87a74491829374237 100644 (file)
@@ -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
                        }
index ba0669a0ad2ab57561d8256e2bb6d8520c7af906..77e35bbae640f5696fec7a2b6a49d8d02ce31500 100644 (file)
@@ -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"
index 3b57cb39f6df3ebd18ac58bb810c041a48704df2..e7107ad1cd0bf3aeab89257b6ef50627c3ed9004 100644 (file)
@@ -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)
index e3390c77ca2891c5e8f7d48899f25f0beadd2d58..ac516c37dd55cb6d56c274cb5c03839244515fb4 100644 (file)
@@ -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>