diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ab7367ba7ad3f..e485f60dbd117 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -779,6 +779,7 @@ archive.title = This repo is archived. You can view files and clone it, but cann archive.issue.nocomment = This repo is archived. You cannot comment on issues. archive.pull.nocomment = This repo is archived. You cannot comment on pull requests. +form.reach_limit_of_creation = You have already reached your limit of %d repositories. form.reach_limit_of_creation_1 = You have already reached your limit of %d repository. form.reach_limit_of_creation_n = You have already reached your limit of %d repositories. form.name_reserved = The repository name '%s' is reserved. diff --git a/routers/repo/migrate.go b/routers/repo/migrate.go index 24d4ef4099bd9..e6da984495a5a 100644 --- a/routers/repo/migrate.go +++ b/routers/repo/migrate.go @@ -60,6 +60,17 @@ func Migrate(ctx *context.Context) { if ctx.Written() { return } + + canCreateRepo := ctx.User.CanCreateRepo() + if !canCreateRepo && ctx.User.ID == ctxUser.ID { + orgs, has := ctx.Data["Orgs"].([]*models.User) + if has && len(orgs) > 0 { + ctxUser = orgs[0] + } + } + + ctx.Data["CanCreateRepo"] = canCreateRepo + ctx.Data["MaxCreationLimit"] = ctx.User.MaxCreationLimit() ctx.Data["ContextUser"] = ctxUser ctx.HTML(http.StatusOK, base.TplName("repo/migrate/"+serviceType.Name())) diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl index 6525a9b4f50c9..72b7f428b74ee 100644 --- a/templates/repo/migrate/git.tmpl +++ b/templates/repo/migrate/git.tmpl @@ -10,6 +10,11 @@
{{template "base/alert" .}} + {{if not .CanCreateRepo}} +
+

{{.i18n.Tr (TrN .i18n.Lang .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n") .MaxCreationLimit}}

+
+ {{end}}
@@ -41,10 +46,12 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}}