diff options
author | Meaglith Ma <genedna@gmail.com> | 2014-03-31 17:23:37 +0800 |
---|---|---|
committer | Meaglith Ma <genedna@gmail.com> | 2014-03-31 17:23:37 +0800 |
commit | 1a247340dbea3404431f60a24bb8f8d06d94b1e9 (patch) | |
tree | 80d3ecab43506e03405c742a84dcc61f474e2212 /modules/middleware/context.go | |
parent | 9047cadcd33f95eebafa2f794b895c8406eb80c5 (diff) | |
parent | dd9fb807a46db120ef800d7465f50a73a86df288 (diff) |
Merge pull request #1 from gogits/master
Sync to lastest
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r-- | modules/middleware/context.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go index d81ab999..d2b268cd 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -15,9 +15,10 @@ import ( "strings" "time" - "github.com/codegangsta/martini" + "github.com/go-martini/martini" "github.com/gogits/cache" + "github.com/gogits/git" "github.com/gogits/session" "github.com/gogits/gogs/models" @@ -41,11 +42,18 @@ type Context struct { csrfToken string Repo struct { - IsValid bool IsOwner bool IsWatching bool + IsBranch bool + IsTag bool + IsCommit bool Repository *models.Repository Owner *models.User + Commit *git.Commit + GitRepo *git.Repository + BranchName string + CommitId string + RepoLink string CloneLink struct { SSH string HTTPS string @@ -98,6 +106,10 @@ func (ctx *Context) Handle(status int, title string, err error) { ctx.HTML(status, fmt.Sprintf("status/%d", status)) } +func (ctx *Context) Debug(msg string, args ...interface{}) { + log.Debug(msg, args...) +} + func (ctx *Context) GetCookie(name string) string { cookie, err := ctx.Req.Cookie(name) if err != nil { @@ -257,7 +269,7 @@ func InitContext() martini.Handler { if user != nil { ctx.Data["SignedUser"] = user ctx.Data["SignedUserId"] = user.Id - ctx.Data["SignedUserName"] = user.LowerName + ctx.Data["SignedUserName"] = user.Name ctx.Data["IsAdmin"] = ctx.User.IsAdmin } |