Bug fix
This commit is contained in:
parent
8b700e825b
commit
5344a03003
4 changed files with 10 additions and 3 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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…
Reference in a new issue