Browse Source

Hide org member in collar page

for-closed-social
Unknwon 10 years ago
parent
commit
41dbb4c148
7 changed files with 31 additions and 13 deletions
  1. +2
    -2
      README.md
  2. +2
    -2
      README_ZH.md
  3. +6
    -2
      cmd/web.go
  4. +1
    -0
      conf/locale/locale_en-US.ini
  5. +1
    -0
      conf/locale/locale_zh-CN.ini
  6. +17
    -6
      routers/repo/setting.go
  7. +2
    -1
      templates/ng/base/alert.tmpl

+ 2
- 2
README.md View File

@ -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)

+ 2
- 2
README_ZH.md View 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)

+ 6
- 2
cmd/web.go View 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)")
}
}

+ 1
- 0
conf/locale/locale_en-US.ini View 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.

+ 1
- 0
conf/locale/locale_zh-CN.ini View 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 钩子删除成功!

+ 17
- 6
routers/repo/setting.go View 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)
}

+ 2
- 1
templates/ng/base/alert.tmpl View 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}}
{{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}}

Loading…
Cancel
Save