From 85a73965256411c36ecc050eeb7967d3c8ef20d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=96stanb=C3=A4ck?= Date: Sat, 20 May 2017 10:47:48 +0200 Subject: [PATCH] Add error direclty when user tries to create new repo and limit already hit (#1767) --- routers/repo/repo.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 9b411648c..e2e2dc7a3 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -67,6 +67,10 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User { // Create render creating repository page func Create(ctx *context.Context) { + if !ctx.User.CanCreateRepo() { + ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", ctx.User.RepoCreationNum()), tplCreate, nil) + } + ctx.Data["Title"] = ctx.Tr("new_repo") // Give default value for template to render.