Issue: Show error prompt when add repository to team and it does not exist #533

release/v1.15
Unknwon 2014-10-10 05:06:12 -04:00
parent c31606daf9
commit 85c9f7c5f3
3 changed files with 7 additions and 0 deletions

View 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

View 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 = 控制面板

View 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
}