]> source.dussan.org Git - gitea.git/commitdiff
Hide org member in collar page
authorUnknwon <joe2010xtmf@163.com>
Fri, 10 Oct 2014 10:15:27 +0000 (06:15 -0400)
committerUnknwon <joe2010xtmf@163.com>
Fri, 10 Oct 2014 10:15:27 +0000 (06:15 -0400)
README.md
README_ZH.md
cmd/web.go
conf/locale/locale_en-US.ini
conf/locale/locale_zh-CN.ini
routers/repo/setting.go
templates/ng/base/alert.tmpl

index 66e965990a7538c6bbba42fe865d67bc658167fd..6eb4afbff9c0d95321ae7d3943b1cc9ab049a398 100644 (file)
--- 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)
index d2d54beb11b8a3fb4d09a4514e604c260450eadb..cb79a43c750091bcd3017bf6baf9878809d22812 100644 (file)
@@ -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)
index 77260b72414c8803ebd79b29276efdfa13adf082..395658f6ed81f1319ca91cb4d4c5528f40f12750 100644 (file)
@@ -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)")
        }
 }
 
index 0f2003b592a7797deb1a33b2f3ad46c91323caa5..2182167ced149852c4199aeb68812b1f98ab86a9 100644 (file)
@@ -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 <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks Guide</a>.
 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.
index da26ce9df73e8bc9bcb336f9d9c5e13c8b3912b6..a2242b450dc1384f3b47cb1a0850329e530c926a 100644 (file)
@@ -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 通知。查看 <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks 文档</a> 获取更多信息。
 settings.remove_hook_success = Web 钩子删除成功!
index 0e58029ec3eb46ee80064f3240b502fc3bf639ee..971c5bef2a6088a069c8dfdf1d215111a1b55eaa 100644 (file)
@@ -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)
 }
 
index df14d3c3bf2d878f06762638a8ec934187cb221c..329ae9108ddfbb00230b89a1ed8771b34592d5e6 100644 (file)
@@ -1,2 +1,3 @@
 {{if .Flash.ErrorMsg}}<span class="alert alert-red alert-radius block text-bold"><i class="octicon octicon-alert"></i>{{.Flash.ErrorMsg}}</span>{{end}}
-{{if .Flash.SuccessMsg}}<div class="alert alert-green alert-radius block"><i class="octicon octicon-check"></i>{{.Flash.SuccessMsg}}</div>{{end}}
\ No newline at end of file
+{{if .Flash.SuccessMsg}}<div class="alert alert-green alert-radius block"><i class="octicon octicon-check"></i>{{.Flash.SuccessMsg}}</div>{{end}}
+{{if .Flash.InfoMsg}}<div class="alert alert-blue alert-radius block"><i class="octicon octicon-info"></i>{{.Flash.InfoMsg}}</div>{{end}}
\ No newline at end of file