]> source.dussan.org Git - gitea.git/commitdiff
Issue: Show error prompt when add repository to team and it does not exist #533
authorUnknwon <joe2010xtmf@163.com>
Fri, 10 Oct 2014 09:06:12 +0000 (05:06 -0400)
committerUnknwon <joe2010xtmf@163.com>
Fri, 10 Oct 2014 09:06:12 +0000 (05:06 -0400)
conf/locale/locale_en-US.ini
conf/locale/locale_zh-CN.ini
routers/org/teams.go

index 15262e630fc87a60f6bb620cbf58cbe5e9e381b7..0f2003b592a7797deb1a33b2f3ad46c91323caa5 100644 (file)
@@ -408,6 +408,7 @@ teams.admin_permission_desc = This team grants <strong>Admin</strong> access: me
 teams.repositories = Team Repositories
 teams.add_team_repository = Add Team Repository
 teams.remove_repo = Remove
+teams.add_nonexistent_repo = The repository you're trying to add does not exist, please create it first.
 
 [admin]
 dashboard = Dashboard
index 8a343d4c8cd08e8015acb60e0bcf20bd3ef9cd62..da26ce9df73e8bc9bcb336f9d9c5e13c8b3912b6 100644 (file)
@@ -408,6 +408,7 @@ teams.admin_permission_desc = 该团队拥有一定的 <strong>管理</strong> 
 teams.repositories = 团队仓库
 teams.add_team_repository = 添加团队仓库
 teams.remove_repo = 移除仓库
+teams.add_nonexistent_repo = 您尝试添加到团队的仓库不存在,请先创建仓库!
 
 [admin]
 dashboard = 控制面板
index 9aa8e502145fc1aa4fcb68b1c6db24010f0d8327..77a7b6e13ca65ed69819fff5bfaa1eb8e5d81de6 100644 (file)
@@ -124,6 +124,11 @@ func TeamsRepoAction(ctx *middleware.Context) {
                var repo *models.Repository
                repo, err = models.GetRepositoryByName(ctx.Org.Organization.Id, repoName)
                if err != nil {
+                       if err == models.ErrRepoNotExist {
+                               ctx.Flash.Error(ctx.Tr("org.teams.add_nonexistent_repo"))
+                               ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories")
+                               return
+                       }
                        ctx.Handle(500, "GetRepositoryByName", err)
                        return
                }