summaryrefslogtreecommitdiffstats
path: root/routers/org
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-05-26 21:12:02 +0800
committerBo-Yi Wu <appleboy.tw@gmail.com>2017-05-26 08:12:02 -0500
commit3611a3e5529329c9ab1a137c0930199959a40e71 (patch)
treef5e900f9eb0a98e38f146d98105ef34c0844f307 /routers/org
parent39348cd27e4114c24234a65c542992273ec8b2b8 (diff)
downloadgitea-3611a3e5529329c9ab1a137c0930199959a40e71.tar.gz
gitea-3611a3e5529329c9ab1a137c0930199959a40e71.zip
fix bug to deny to add orgnization as a member of an orgnization or team (#1815)
Diffstat (limited to 'routers/org')
-rw-r--r--routers/org/members.go6
-rw-r--r--routers/org/teams.go6
2 files changed, 12 insertions, 0 deletions
diff --git a/routers/org/members.go b/routers/org/members.go
index 70e4161c00..1b74b5f740 100644
--- a/routers/org/members.go
+++ b/routers/org/members.go
@@ -114,6 +114,12 @@ func Invitation(ctx *context.Context) {
return
}
+ if u.IsOrganization() {
+ ctx.Flash.Error(ctx.Tr("form.cannot_invite_org_to_org"))
+ ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
+ return
+ }
+
if err = org.AddMember(u.ID); err != nil {
ctx.Handle(500, " AddMember", err)
return
diff --git a/routers/org/teams.go b/routers/org/teams.go
index 914561b52a..10c86bd5cf 100644
--- a/routers/org/teams.go
+++ b/routers/org/teams.go
@@ -88,6 +88,12 @@ func TeamsAction(ctx *context.Context) {
return
}
+ if u.IsOrganization() {
+ ctx.Flash.Error(ctx.Tr("form.cannot_add_org_to_team"))
+ ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName)
+ return
+ }
+
err = ctx.Org.Team.AddMember(u.ID)
page = "team"
}