diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-25 14:51:01 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-25 14:53:59 +0800 |
commit | faabc76fd68b0ecccba1dc8dae47220b28cce05a (patch) | |
tree | d0a7f9b6417bc0bf596b3e0ed4f53e055d90a930 /modules/context/repo.go | |
parent | 6a28909f40ad1ff20d325d9be4ada87e5b75ce53 (diff) | |
download | gitea-faabc76fd68b0ecccba1dc8dae47220b28cce05a.tar.gz gitea-faabc76fd68b0ecccba1dc8dae47220b28cce05a.zip |
Golint fixed for modules/context
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r-- | modules/context/repo.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index e3683a1498..6135ac46ae 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -19,6 +19,7 @@ import ( macaron "gopkg.in/macaron.v1" ) +// PullRequest contains informations to make a pull request type PullRequest struct { BaseRepo *models.Repository Allowed bool @@ -26,6 +27,7 @@ type PullRequest struct { HeadInfo string // [<user>:]<branch> } +// Repository contains informations to operate a repository type Repository struct { AccessMode models.AccessMode IsWatching bool @@ -96,6 +98,7 @@ func (r *Repository) GetEditorconfig() (*editorconfig.Editorconfig, error) { return editorconfig.ParseBytes(data) } +// RetrieveBaseRepo retrieves base repository func RetrieveBaseRepo(ctx *Context, repo *models.Repository) { // Non-fork repository will not return error in this method. if err := repo.GetBaseRepo(); err != nil { @@ -130,6 +133,7 @@ func earlyResponseForGoGetMeta(ctx *Context) { }))) } +// RepoAssignment returns a macaron to handle repository assignment func RepoAssignment(args ...bool) macaron.Handler { return func(ctx *Context) { var ( @@ -446,6 +450,7 @@ func RepoRef() macaron.Handler { } } +// RequireRepoAdmin returns a macaron middleware for requiring repository admin permission func RequireRepoAdmin() macaron.Handler { return func(ctx *Context) { if !ctx.IsSigned || (!ctx.Repo.IsAdmin() && !ctx.User.IsAdmin) { @@ -455,6 +460,7 @@ func RequireRepoAdmin() macaron.Handler { } } +// RequireRepoWriter returns a macaron middleware for requiring repository write permission func RequireRepoWriter() macaron.Handler { return func(ctx *Context) { if !ctx.IsSigned || (!ctx.Repo.IsWriter() && !ctx.User.IsAdmin) { |