diff --git a/README.md b/README.md index 66e965990a..6eb4afbff9 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The goal of this project is to make the easiest, fastest and most painless way t - Slack webhook integration - Supports MySQL, PostgreSQL and SQLite3 - Social account login(GitHub, Google, QQ, Weibo) -- Multi-language support(English, Chinese, Germany, French, Dutch etc.) +- Multi-language support(English, Simplified Chinese, Traditional Chinese, Germany, French, Dutch etc.) ## System Requirements @@ -57,7 +57,7 @@ Make sure you install [Prerequirements](http://gogs.io/docs/installation/) first There are 5 ways to install Gogs: -- [Install from binary](http://gogs.io/docs/installation/install_from_binary.md): **STRONGLY RECOMMENDED** +- [Install from binary](http://gogs.io/docs/installation/install_from_binary.md) - [Install from source](http://gogs.io/docs/installation/install_from_source.md) - [Install from packages](http://gogs.io/docs/installation/install_from_packages.md) - [Ship with Docker](https://github.com/gogits/gogs/tree/master/docker) diff --git a/README_ZH.md b/README_ZH.md index d2d54beb11..cb79a43c75 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -35,7 +35,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自 - Slack Web 钩子集成 - 支持 MySQL、PostgreSQL 以及 SQLite3 数据库 - 社交帐号登录(GitHub、Google、QQ、微博) -- 多语言支持(英文、简体中文、德语、法语、荷兰语等等) +- 多语言支持(英文、简体中文、繁体中文、德语、法语、荷兰语等等) ## 系统要求 @@ -48,7 +48,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自 然后,您可以通过以下 5 种方式来安装 Gogs: -- [二进制安装](http://gogs.io/docs/installation/install_from_binary.md): **强烈推荐** +- [二进制安装](http://gogs.io/docs/installation/install_from_binary.md) - [源码安装](http://gogs.io/docs/installation/install_from_source.md) - [包管理安装](http://gogs.io/docs/installation/install_from_packages.md) - [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/docker) diff --git a/cmd/web.go b/cmd/web.go index 77260b7241..395658f6ed 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -64,11 +64,15 @@ func checkVersion() { // Check dependency version. macaronVer := git.MustParseVersion(strings.Join(strings.Split(macaron.Version(), ".")[:3], ".")) if macaronVer.LessThan(git.MustParseVersion("0.2.0")) { - log.Fatal(4, "Macaron version is too old, did you forget to update?(github.com/Unknwon/macaron)") + log.Fatal(4, "Package macaron version is too old, did you forget to update?(github.com/Unknwon/macaron)") } i18nVer := git.MustParseVersion(i18n.Version()) if i18nVer.LessThan(git.MustParseVersion("0.0.2")) { - log.Fatal(4, "i18n version is too old, did you forget to update?(github.com/macaron-contrib/i18n)") + log.Fatal(4, "Package i18n version is too old, did you forget to update?(github.com/macaron-contrib/i18n)") + } + sessionVer := git.MustParseVersion(session.Version()) + if sessionVer.LessThan(git.MustParseVersion("0.0.1")) { + log.Fatal(4, "Package session version is too old, did you forget to update?(github.com/macaron-contrib/session)") } } diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 0f2003b592..2182167ced 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -309,6 +309,7 @@ settings.confirm_delete = Confirm Deletion settings.add_collaborator = Add New Collaborator settings.add_collaborator_success = New collaborator has been added. settings.remove_collaborator_success = Collaborator has been removed. +settings.user_is_org_member = User is organization member who cannot be added as a collaborator. settings.add_webhook = Add Webhook settings.hooks_desc = Webhooks allow external services to be notified when certain events happen on Gogs. When the specified events happen, we'll send a POST request to each of the URLs you provide. Learn more in our Webhooks Guide. settings.githooks_desc = Git Hooks are powered by Git itself, you can edit files of supported hooks in the list below to apply custom operations. diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini index da26ce9df7..a2242b450d 100644 --- a/conf/locale/locale_zh-CN.ini +++ b/conf/locale/locale_zh-CN.ini @@ -309,6 +309,7 @@ settings.confirm_delete = 确认删除仓库 settings.add_collaborator = 增加新的协作者 settings.add_collaborator_success = 成功添加新的协作者! settings.remove_collaborator_success = 被操作的协作者已经被收回权限! +settings.user_is_org_member = 被操作的用户是组织成员,因此无法添加为协作者! settings.add_webhook = 添加 Web 钩子 settings.hooks_desc = Web 钩子允许您设定在 Gogs 上发生指定事件时对指定 URL 发送 POST 通知。查看 Webhooks 文档 获取更多信息。 settings.remove_hook_success = Web 钩子删除成功! diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 0e58029ec3..971c5bef2a 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -196,9 +196,16 @@ func SettingsCollaboration(ctx *middleware.Context) { return } + // Check if user is organization member. + if ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOrgMember(u.Id) { + ctx.Flash.Info(ctx.Tr("repo.settings.user_is_org_member")) + ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") + return + } + if err = models.AddAccess(&models.Access{UserName: name, RepoName: repoLink, Mode: models.WRITABLE}); err != nil { - ctx.Handle(500, "AddAccess2", err) + ctx.Handle(500, "AddAccess", err) return } @@ -247,16 +254,20 @@ func SettingsCollaboration(ctx *middleware.Context) { return } - us := make([]*models.User, len(names)) - for i, name := range names { - us[i], err = models.GetUserByName(name) + collaborators := make([]*models.User, 0, len(names)) + for _, name := range names { + u, err := models.GetUserByName(name) if err != nil { ctx.Handle(500, "GetUserByName", err) return } + // Does not show organization members. + if ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOrgMember(u.Id) { + continue + } + collaborators = append(collaborators, u) } - - ctx.Data["Collaborators"] = us + ctx.Data["Collaborators"] = collaborators ctx.HTML(200, COLLABORATION) } diff --git a/templates/ng/base/alert.tmpl b/templates/ng/base/alert.tmpl index df14d3c3bf..329ae9108d 100644 --- a/templates/ng/base/alert.tmpl +++ b/templates/ng/base/alert.tmpl @@ -1,2 +1,3 @@ {{if .Flash.ErrorMsg}}{{.Flash.ErrorMsg}}{{end}} -{{if .Flash.SuccessMsg}}
{{.Flash.SuccessMsg}}
{{end}} \ No newline at end of file +{{if .Flash.SuccessMsg}}
{{.Flash.SuccessMsg}}
{{end}} +{{if .Flash.InfoMsg}}
{{.Flash.InfoMsg}}
{{end}} \ No newline at end of file