mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 01:22:21 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
df1985e1e8
|
@ -6,6 +6,7 @@ package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/codegangsta/martini"
|
"github.com/codegangsta/martini"
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ func RepoAssignment(redirect bool) martini.Handler {
|
||||||
)
|
)
|
||||||
|
|
||||||
// get repository owner
|
// get repository owner
|
||||||
ctx.Repo.IsOwner = ctx.IsSigned && ctx.User.LowerName == params["username"]
|
ctx.Repo.IsOwner = ctx.IsSigned && ctx.User.LowerName == strings.ToLower(params["username"])
|
||||||
|
|
||||||
if !ctx.Repo.IsOwner {
|
if !ctx.Repo.IsOwner {
|
||||||
user, err = models.GetUserByName(params["username"])
|
user, err = models.GetUserByName(params["username"])
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/codegangsta/martini"
|
"github.com/codegangsta/martini"
|
||||||
|
// "github.com/slene/blackfriday"
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
|
@ -42,6 +43,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
params["branchname"] = "master"
|
params["branchname"] = "master"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Directory and file list.
|
||||||
treename := params["_1"]
|
treename := params["_1"]
|
||||||
files, err := models.GetReposFiles(params["username"], params["reponame"],
|
files, err := models.GetReposFiles(params["username"], params["reponame"],
|
||||||
params["branchname"], treename)
|
params["branchname"], treename)
|
||||||
|
@ -53,6 +55,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.Data["Reponame"] = params["reponame"]
|
ctx.Data["Reponame"] = params["reponame"]
|
||||||
ctx.Data["Branchname"] = params["branchname"]
|
ctx.Data["Branchname"] = params["branchname"]
|
||||||
|
|
||||||
|
// Branches.
|
||||||
brs, err := models.GetBranches(params["username"], params["reponame"])
|
brs, err := models.GetBranches(params["username"], params["reponame"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(200, "repo.Single", err)
|
ctx.Handle(200, "repo.Single", err)
|
||||||
|
@ -70,6 +73,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Latest commit.
|
||||||
commit, err := models.GetLastestCommit(params["username"], params["reponame"])
|
commit, err := models.GetLastestCommit(params["username"], params["reponame"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(200, "repo.Single", err)
|
ctx.Handle(200, "repo.Single", err)
|
||||||
|
@ -77,6 +81,15 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
}
|
}
|
||||||
ctx.Data["LatestCommit"] = commit
|
ctx.Data["LatestCommit"] = commit
|
||||||
|
|
||||||
|
// README.
|
||||||
|
// for _, f := range files {
|
||||||
|
// if f.Name == "README.md" {
|
||||||
|
// ctx.Data["ReadmeName"] = "README.md"
|
||||||
|
// ctx.Data["ReadmeContent"] =
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
ctx.Data["Paths"] = Paths
|
ctx.Data["Paths"] = Paths
|
||||||
ctx.Data["Treenames"] = treenames
|
ctx.Data["Treenames"] = treenames
|
||||||
ctx.Data["IsRepoToolbarSource"] = true
|
ctx.Data["IsRepoToolbarSource"] = true
|
||||||
|
|
Loading…
Reference in a new issue