summaryrefslogtreecommitdiffstats
path: root/routers/repo/repo.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-10-29 19:04:25 -0700
committerLunny Xiao <xiaolunwen@gmail.com>2017-10-30 10:04:25 +0800
commit513375c429435ba60a667b219bdfb00e5b760b38 (patch)
tree9f516c8d0ebbdc66808c9017df7db2ff9aa34b57 /routers/repo/repo.go
parent6e98812ecf4efb6f53d72414ca8f67b14fac6595 (diff)
downloadgitea-513375c429435ba60a667b219bdfb00e5b760b38.tar.gz
gitea-513375c429435ba60a667b219bdfb00e5b760b38.zip
Make URL scheme unambiguous (#2408)
* Make URL scheme unambiguous Redirect old routes to new routes * Fix redirects to new URL scheme, and update template * Fix branches/_new endpoints, and update integration test
Diffstat (limited to 'routers/repo/repo.go')
-rw-r--r--routers/repo/repo.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index ebbce1e19c..dbe78f6d1e 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -34,6 +34,21 @@ func MustBeNotBare(ctx *context.Context) {
}
}
+// MustBeEditable check that repo can be edited
+func MustBeEditable(ctx *context.Context) {
+ if !ctx.Repo.Repository.CanEnableEditor() || ctx.Repo.IsViewCommit {
+ ctx.Handle(404, "", nil)
+ return
+ }
+}
+
+// MustBeAbleToUpload check that repo can be uploaded to
+func MustBeAbleToUpload(ctx *context.Context) {
+ if !setting.Repository.Upload.Enabled {
+ ctx.Handle(404, "", nil)
+ }
+}
+
func checkContextUser(ctx *context.Context, uid int64) *models.User {
orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.ID, "updated_unix")
if err != nil {