diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 15262e630fc8..0f2003b592a7 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -408,6 +408,7 @@ teams.admin_permission_desc = This team grants Admin 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 diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini index 8a343d4c8cd0..da26ce9df73e 100644 --- a/conf/locale/locale_zh-CN.ini +++ b/conf/locale/locale_zh-CN.ini @@ -408,6 +408,7 @@ teams.admin_permission_desc = 该团队拥有一定的 管理 teams.repositories = 团队仓库 teams.add_team_repository = 添加团队仓库 teams.remove_repo = 移除仓库 +teams.add_nonexistent_repo = 您尝试添加到团队的仓库不存在,请先创建仓库! [admin] dashboard = 控制面板 diff --git a/routers/org/teams.go b/routers/org/teams.go index 9aa8e502145f..77a7b6e13ca6 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -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 }